Gunicorn worker timeout error

后端 未结 15 1945
梦谈多话
梦谈多话 2020-11-29 16:07

I have setup gunicorn with 3 workers 30 worker connections and using eventlet worker class. It is setup behind Nginx. After every few requests, I see this in the logs.

相关标签:
15条回答
  • 2020-11-29 16:48

    We had the same problem using Django+nginx+gunicorn. From Gunicorn documentation we have configured the graceful-timeout that made almost no difference.

    After some testings, we found the solution, the parameter to configure is: timeout (And not graceful timeout). It works like a clock..

    So, Do:

    1) open the gunicorn configuration file

    2) set the TIMEOUT to what ever you need - the value is in seconds

    NUM_WORKERS=3
    TIMEOUT=120
    
    exec gunicorn ${DJANGO_WSGI_MODULE}:application \
    --name $NAME \
    --workers $NUM_WORKERS \
    --timeout $TIMEOUT \
    --log-level=debug \
    --bind=127.0.0.1:9000 \
    --pid=$PIDFILE
    
    0 讨论(0)
  • 2020-11-29 16:53

    Run Gunicorn with --log-level debug.

    It should give you an app stack trace.

    0 讨论(0)
  • 2020-11-29 16:53

    If you are using GCP then you have to set workers per instance type.

    Link to GCP best practices https://cloud.google.com/appengine/docs/standard/python3/runtime

    0 讨论(0)
提交回复
热议问题