I’m curious to know how folks use async Djagno in production. Have you switched a project over? Fully or critical code only? What was your experience like? Was it worth it?
I made an example app to demonstrate superiority in a confined test. I’ve found it quite awkward converting existing sync views to async. Fetching a limited queryset for json serialization is awkward [x async for x in values]
. Some ORM functions, like get_or_create, appear to be just wrappers that call sync_to_async. Django Rest Framework doesn’t support async and adrf doesn’t support everything.
I didn’t look super closely at the example app, but it looks like it is comparing a sync vs async view? Or wsgi vs asgi? I think even with a single wsgi worker running sync code you should be able to handle more than one request at once if they’re IO bound (e.g. waiting on db queries), since each request runs in its own thread. Although that might still require using a different kind of gunicorn worker to make it use a thread per request like that.
To answer your original question, we “sort of” use async in production, but only by using asgi and the uvicorn worker class. All of our view/orm code is sync still. We do not get a very large volume of requests at all but I haven’t seen any performance issues due to concurrent or long-running requests using this setup for a few years now.