admin管理员组文章数量:1401291
I can't find a way to serve our large Django application using all three of preload, ASGI, and SO_REUSEPORT
.
Without preload and fork we use much more memory (gigabytes).
Without ASGI we can't serve websockets (and starting another server just for websockets would violate our memory constraints).
Without SO_REUSEPORT
we can run multiple preloaded/forked workers but traffic biases heavily (70%) to one worker, negating much of the benefit.
We currently use gunicorn + uvicorn workers to achieve preload + ASGI. Gunicorn has an unreleased reuse_port
mode that doesn't seem to do anything when using gunicorn + uvicorn.
We looked at using granian or uvicorn itself as the process manager, but neither support preload/fork and so won't work due to our memory constraints.
I can't find a way to serve our large Django application using all three of preload, ASGI, and SO_REUSEPORT
.
Without preload and fork we use much more memory (gigabytes).
Without ASGI we can't serve websockets (and starting another server just for websockets would violate our memory constraints).
Without SO_REUSEPORT
we can run multiple preloaded/forked workers but traffic biases heavily (70%) to one worker, negating much of the benefit.
We currently use gunicorn + uvicorn workers to achieve preload + ASGI. Gunicorn has an unreleased reuse_port
mode that doesn't seem to do anything when using gunicorn + uvicorn.
We looked at using granian or uvicorn itself as the process manager, but neither support preload/fork and so won't work due to our memory constraints.
Share Improve this question edited Mar 23 at 4:45 Beau asked Mar 23 at 4:36 BeauBeau 11.4k8 gold badges46 silver badges38 bronze badges1 Answer
Reset to default 0It turns out gunicorn HEAD + uvicorn worker does work with reuse_port=True
, so it is possible to achieve all three of ASGI, preload, and SO_REUSEPORT. When you test your setup ensure that you turn off HTTP keepalives or you will bias to one worker for that reason, which is why I initially thought the new reuse_port=True
option did not work.
本文标签:
版权声明:本文标题:gunicorn - Is there any way to serve a Django application using preload, ASGI, and SO_REUSEPORT? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744297259a2599402.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论