2

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.

1 Answer 1

0

It 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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.