According to the official guide
https://docs.gunicorn.org/en/latest/settings.html#settings
a worker will restart when it has handled max_requests
requests.
But when max_requests_jitter
is set, a worker will restart when it has handled randint(0, max_requests_jitter)
request, to stagger worker restarts to avoid all workers restarting at the same time.
Is that means max_requests_jitter
setting will override max_requests
and make it be invalid?
From the docs -
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.
What I understand is that the jitter is a random addition to each worker and the term max_requests_jitter
should be (though not necessary) smaller than max_requests
.
In other words, worker_1 will restart after max_requests + j1
requests, worker_2 will restart after max_requests + j2
requests etc. where the values of j1, j2, j3...
are determined by the max_requests_jitter
argument.