auto scale uwsgi workers based on load

This commit is contained in:
wh1te909
2022-06-25 09:00:59 +00:00
parent 77f04e1a32
commit f63e801608
4 changed files with 43 additions and 44 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
SCRIPT_VERSION="37"
SCRIPT_VERSION="38"
SCRIPT_URL='https://raw.githubusercontent.com/amidaware/tacticalrmm/master/restore.sh'
sudo apt update
@@ -245,23 +245,12 @@ npm install meshcentral@${MESH_VER}
print_green 'Restoring the backend'
echo 'Optimize for number of processors'
numprocs=$(nproc)
uwsgiprocs=4
if [[ "$numprocs" == "1" ]]; then
uwsgiprocs=2
else
uwsgiprocs=$numprocs
fi
uwsgini="$(cat << EOF
[uwsgi]
chdir = /rmm/api/tacticalrmm
module = tacticalrmm.wsgi
home = /rmm/api/env
master = true
processes = ${uwsgiprocs}
threads = ${uwsgiprocs}
enable-threads = true
socket = /rmm/api/tacticalrmm/tacticalrmm.sock
harakiri = 300
@@ -271,6 +260,16 @@ vacuum = true
die-on-term = true
max-requests = 500
disable-logging = true
cheaper-algo = busyness
cheaper = 4
cheaper-initial = 4
workers = 20
cheaper-step = 2
cheaper-overload = 3
cheaper-busyness-min = 5
cheaper-busyness-max = 10
# stats = /tmp/stats.socket # uncomment when debugging
# cheaper-busyness-verbose = true # uncomment when debugging
EOF
)"
echo "${uwsgini}" > /rmm/api/tacticalrmm/app.ini