Gunicorn with maximum blocks of maximum voltage at high load

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:

# nginx
upstream gunicorn_app {
    server 127.0.0.1:8100;
}
server {
    listen 443 ssl;
    ...
    # skipping static files config
    ...
    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
+4
source share
1 answer

Not sure what might be the problem here.

, :

  • on_reload. SIGHUP. .

    def on_reload(server): #Print some debug message

  • worker_int: SIGINT SIGQUIT.

    def worker_int(worker): #Print some debug message

  • pre_request. , .

    def pre_request(worker, req): #Print some debug message #worker.log.debug("%s %s" % (req.method, req.path))

  • post_request. , .

    def post_request(worker, req, environ, resp): #Print some debug message

.

:  http://docs.gunicorn.org/en/stable/settings.html#server-hooks

-1

Source: https://habr.com/ru/post/1620273/


All Articles