3 ms·
I wonder how popular the async interface will become. I use Python and Django extensively but haven't touch any of the async operations.
by sirodoht 4y ago
I wonder how popular the async interface will become. I use Python and Django extensively but haven't touch any of the async operations.
- jonatron 4y agoOnce the underlying database queries become async, I can see it becoming popular. Many views do multiple database queries that aren't dependent on each other, which would be a quick win to make async.
- Chiron1991 4y agoSince ultimately anything you build in Django will eventually go into the ORM layer, it won't become anything unless the ORM is fully async. This release brings the async API to it, but: > Note that, at this stage, the underlying database operations remain synchronous That kinda defeats the whole purpose of an ASGI app.
- 0xDEFACED 4y ago>That kinda defeats the whole purpose of an ASGI app. Unless I’m missing something, wouldn’t an async ORM provide significant benefit for apps with an internet-based DB connection? I would think the underlying DB ops would be much faster than sending a request and waiting on a response.
- tecleandor 4y agoBut you could use it for load not tied to database, isn't it? Like CPU, IO or network bound stuff...
- aynyc 4y agoYou don't use async for CPU. Python async is actually asyncio, so I/O and network such as calling external API, etc.. It'll make integration much easier to reason about.
- Piezoid 4y agoI use the event loop to defer the (io heavy) post-processing of some requests without involving an off-process task runner like Celery. I use a custom implementation of this: https://django-simple-task.readthedocs.io/how-it-works.html https://django-simple-task.readthedocs.io/how-it-works.html It is way simpler when you don't need strong guaranties and checkpoints persistence.