Gunicorn中max_requests和max_requests_jitter之间的机制是什么
根据官方指南
https://docs.gunicorn.org/en/latest/ settings.html#settings
工作线程在处理完 max_requests
请求后将重新启动。
但是,当设置了 max_requests_jitter 时,工作线程将在处理 randint(0, max_requests_jitter) 请求后重新启动,以错开工作线程重新启动,以避免所有工作线程同时重新启动。
这是否意味着 max_requests_jitter
设置会覆盖 max_requests
并使其无效?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 文档 -
我的理解是,抖动是每个工作线程的随机添加,并且术语 max_requests_jitter 应该(尽管不是必需的)小于 max_requests 。
换句话说,worker_1 将在
max_requests + j1
请求后重新启动,worker_2 将在max_requests + j2
请求后重新启动,依此类推,其中j1、j2、j3 的值。 ..
由max_requests_jitter
参数确定。From the docs -
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 thanmax_requests
.In other words, worker_1 will restart after
max_requests + j1
requests, worker_2 will restart aftermax_requests + j2
requests etc. where the values ofj1, j2, j3...
are determined by themax_requests_jitter
argument.