On Fri, Jun 7, 2019 at 9:19 AM John Obelenus <jobele...@gmail.com> wrote:
> I wonder about the end-result payoff of this approach. In general, > Django/Python code is not going to be I/O bound, which is where > asynchronous approaches are going to get the bang for your buck. Even when > it comes to DB access—the DB is a lot faster than the python and django > code running against the result set. And too much context-switching (as you > noted) has painful ramifications for performance. > To the contrary, I have found that as you scale up, a large amount of your time becomes I/O (either HTTP calls to other components/hosted serviecs or database calls). Our APM at work shows me that it's around 80% of request time. Obviously we don't design Django just for large use cases, which is why it's not going to be the default, but with the massive growth of hosted services, I suspect this trend will continue to trickle down to smaller deploys too. And ultimately, for smaller deploys performance is rarely a concern anyway. > > I can absolutely see why creating a layer that handles asgi, websockets, > and http requests asynchronously is going to pay off. Bit time. But I'm > less certain that the ORM access will benefit from an asyncio approach. Do > we have anything that approaches a hard number that would tell us re-doing > the ORM layer in asyncio would get us X% performance benefit? > > I'm basing my thoughts off this well-reasoned look at performance: > https://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/ > > I do not personally have hard numbers that I am allowed to share, unfortunately, but I would encourage you to look at results on benchmarks that include database access - like this one ( https://twitter.com/_tomchristie/status/1005001902092967936) using Python asyncio/ASGI - and see that it does make a difference. Obviously it doesn't matter for all deploys, but I believe it matters for the majority of site architectures as they scale up. Andrew -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAFwN1urJVeamhLWLLDpkz_-e1fAM59x6b6rzyAV%3DZAUgg9qrvQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.