I am trying to understand the following scenario:
- I have a website with nginx in front (it works with SSL, config see below).
- requests to the Django application are processed using gunicorn (0.18, config see below, controlled by the supervisor)
- when a user loads a website, 10 requests are processed using a gun (others are static files served by nginx) - these requests are not long-lasting requests
- gunicorn is configured to execute a maximum of 1000 requests per employee until the employee is updated
- About 450 people can load a page in a short amount of time (1-2 minutes).
- after that, the machine gunner somehow blocks and does not process more connections, the result is that nginx responds
Gateway Timeoutafter a while
I believe that the restart of the workers does not actually occur or the mechanism is blocked by loading? I want to understand what is happening to fix this problem.
Can anyone explain what is going on here? Many thanks!
PS: I am tied to using gunicorn 18.0, a newer version is currently not possible.
Here are the configurations I use.
Nginx:
upstream gunicorn_app {
server 127.0.0.1:8100;
}
server {
listen 443 ssl;
...
...
location @proxy_gunicorn_app {
proxy_read_timeout 1800;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://gunicorn_app;
}
}
gunicorn (started via supervisord):
# gunicorn
python manage run_gunicorn --workers 4 --max-requests 1000 -b 127.0.0.1:8100 --timeout 1800
source
share