[Django]-Gunicorn gevent workers vs Uvicorn ASGI

16👍

Gunicorn has a pre-fork worker model

A pre-fork worker model basically means a master creates forks which handle each request. A fork is a completely separate *nix process (Source).

Uvicorn is a ASGI server running uvloop

Python async needs a event loop for it to use it’s async features. And uvloop is an alternative to the asyncio loop. So if you’re having async calls in your code you could use uvloop internally or use uvicorn as your ASGI server. Note: You still have just a single event loop. You can choose to use gunicorn and uvicorn to have multiple workers and use uvloop.

In your django application it makes sense to use uvloop internally (if you choose to) and use gunicorn as your ASGI.

Leave a comment