设置 gunicorn 和 celery 的 worker 数量,最小是 2

This commit is contained in:
virusdefender
2019-01-05 14:53:55 +08:00
parent a52f383930
commit 5ae50e4e54
2 changed files with 11 additions and 2 deletions

View File

@@ -28,7 +28,7 @@ stopwaitsecs = 5
killasgroup=true
[program:gunicorn]
command=sh -c "gunicorn oj.wsgi --user server --group spj -b 127.0.0.1:8080 --reload -w `grep -c ^processor /proc/cpuinfo`"
command=gunicorn oj.wsgi --user server --group spj --bind 127.0.0.1:8080 --workers %(ENV_MAX_WORKER_NUM)s --threads 4 --max-requests-jitter 10000 --max-requests 1000000 --keep-alive 32
directory=/app/
stdout_logfile=/data/log/gunicorn.log
stderr_logfile=/data/log/gunicorn.log
@@ -39,7 +39,7 @@ stopwaitsecs = 5
killasgroup=true
[program:celery]
command=celery -A oj worker -l warning
command=celery -A oj worker -l warning --autoscale 2,%(ENV_MAX_WORKER_NUM)s
directory=/app/
user=nobody
stdout_logfile=/data/log/celery.log