فهرست منبع

set worker count based on memory limit

we operate taiga in "synchronous" mode. so sometimes the export fails
because we hit the worker limit

http://taigaio.github.io/taiga-doc/dist/setup-production.html#_async_tasks_optional

fixes #8
Girish Ramakrishnan 7 سال پیش
والد
کامیت
3e24c99cca
1فایلهای تغییر یافته به همراه7 افزوده شده و 1 حذف شده
  1. 7 1
      start.sh

+ 7 - 1
start.sh

@@ -76,4 +76,10 @@ PYTHONPATH=/app/code/taiga/lib/python3.5/site-packages
 
 cd /app/code/taiga-back
 
-exec /usr/local/bin/gosu cloudron:cloudron gunicorn -w 1 -t 60 --pythonpath=. -b 127.0.0.1:8001 taiga.wsgi
+memory_limit=$(cat /sys/fs/cgroup/memory/memory.limit_in_bytes)
+worker_count=$((memory_limit/1024/1024/150)) # 1 worker for 150M
+worker_count=$((worker_count > 8 ? 8 : worker_count )) # max of 8
+worker_count=$((worker_count < 1 ? 1 : worker_count )) # min of 1
+
+echo "Starting gunicorn with ${worker_count} workers"
+exec /usr/local/bin/gosu cloudron:cloudron gunicorn -w ${worker_count} -t 60 --pythonpath=. -b 127.0.0.1:8001 taiga.wsgi