Is there any way to serve a Django application using preload, ASGI, and SO_REUSEPORT?

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.

Вернуться на верх