gunicorn
gunicorn copied to clipboard
gunicorn gevent master process distribute request to worker process unequally.
I have 11 workers, but gunicorn master always distributes request to certain process, not to all process equally.
my gunicorn.conf.py
# -*- coding: utf-8 -*-
from gevent import monkey
monkey.patch_all()
bind = '0.0.0.0:10001'
preload_app = True
workers = 11
worker_connections = 1000
# Any value greater than zero will limit the number of requests a worker will process before automatically restarting.
# This is a simple method to help limit the memory leaks damage.
max_requests = 2000
# The jitter causes the restart per worker to be randomized by randint(0, max_requests_jitter).
# This is intended to stagger worker restarts to avoid all workers restarting at the same time.
max_requests_jitter = 20
backlog = 2048
timeout = 60 * 15
worker_class = "gevent"
proc_name = 'gunicorn.proc'
pidfile = '/tmp/gunicorn.pid'
loglevel = 'info'
# https://docs.gunicorn.org/en/stable/settings.html#access-log-format
access_log_format = '%(t)s %(p)s %(h)s "%(r)s" %(s)s %(T)s %(b)s %(f)s" "%(a)s"'
application is running in docker container, docker host has 24 core CPU.
See if --reuse-port` helps. I believe that it should, under Linux. We were going to make this a default but it caused some issues during development, if I remember correctly.
no activity since a while. closing
(Linking relevant PR #2938 for anyone in the future stumbling across this)