The title is misleading. The blog post doesn't cover how fast using async python is, it's a tutorial on how to use their ORM redis library.
There's a link on the page which digs in a bit more: https://magic.io/blog/uvloop-blazing-fast-python-networking/
Write Fast Apps Using Async Python 3.6 and Redis
21–30 of 134 posts
Re: Write Fast Apps Using Async Python 3.6 and Redis
#22more performant than....what exactly? If I need to load 1000 rows from a database and splash them on a webpage, will my response time go from the 300ms it takes without asyncio to something "more performant", like 50ms? Answer: no. async only gives you throughput, it has nothing to do with "faster" as far as the Python interpreter / GIL / anything like that. If you aren't actually spanning among dozens/hundreds/thousands of network connections, non-blocking IO isn't buying you much at all over using blocking IO with threads, and of course async / greenlets / threads are not a prerequisite for non-blocking IO in any case (only select() is).
it's nice that uvloop seems to be working on removing the terrible performance latency that out-of-the-box asyncio adds, so that's a reason that asyncio can really be viable as a means of gaining throughput without adding lots of latency you wouldn't get with gevent. But I can do without the enforced async boilerplate. Thanks javascript!
Re: Write Fast Apps Using Async Python 3.6 and Redis
#23Earlier quoted context omitted.
I have never found a good example of a Python web server that provides some mechanism for statefulness. Is it just fundamentally not possible to have shared state among requests handled by the threads of a process? Sanic's examples seem to be the same as Flask's: self-contained function calls attached to endpoints. I keep hitting a wall with Python when I want to do something like: 1. subscribe to a websocket connect…
You can use caching to mimic this behaviour in Flask, I.e. http://flask.pocoo.org/docs/0.12/patterns/caching/ I'm not sure how this works with multiple threads though, I imagine you would have to synchronize it yourself.
Re: Write Fast Apps Using Async Python 3.6 and Redis
#24> we make heavy use of asyncio because it’s more performant more performant than....what exactly? If I need to load 1000 rows from a database and splash them on a webpage, will my response time go from the 300ms it takes without asyncio to something "more performant", like 50ms? Answer: no. async only gives you throughput, it has nothing to do with "faster" as far as the Python interpreter / GIL / anything like that.…
Then you'll really be irritated.
Re: Write Fast Apps Using Async Python 3.6 and Redis
#25> we make heavy use of asyncio because it’s more performant more performant than....what exactly? If I need to load 1000 rows from a database and splash them on a webpage, will my response time go from the 300ms it takes without asyncio to something "more performant", like 50ms? Answer: no. async only gives you throughput, it has nothing to do with "faster" as far as the Python interpreter / GIL / anything like that.…
Heh. Somebody will assemble a few of these pieces, add a package manager for async oriented libs, call it node.py, and then market it a bit. Then you'll really be irritated.
/calls lawyers
Re: Write Fast Apps Using Async Python 3.6 and Redis
#26> we make heavy use of asyncio because it’s more performant more performant than....what exactly? If I need to load 1000 rows from a database and splash them on a webpage, will my response time go from the 300ms it takes without asyncio to something "more performant", like 50ms? Answer: no. async only gives you throughput, it has nothing to do with "faster" as far as the Python interpreter / GIL / anything like that.…
Heh. Somebody will assemble a few of these pieces, add a package manager for async oriented libs, call it node.py, and then market it a bit. Then you'll really be irritated.
Re: Write Fast Apps Using Async Python 3.6 and Redis
#27We've just recently started using Sanic[0] paired with Redis to great effect for a very high throughput web service. It also uses Python 3 asyncio/uvloop at its core. So far very happy with it. [0] https://github.com/channelcat/sanic
I have never found a good example of a Python web server that provides some mechanism for statefulness. Is it just fundamentally not possible to have shared state among requests handled by the threads of a process? Sanic's examples seem to be the same as Flask's: self-contained function calls attached to endpoints. I keep hitting a wall with Python when I want to do something like: 1. subscribe to a websocket connect…
Re: Write Fast Apps Using Async Python 3.6 and Redis
#28Earlier quoted context omitted.
You can use caching to mimic this behaviour in Flask, I.e. http://flask.pocoo.org/docs/0.12/patterns/caching/ I'm not sure how this works with multiple threads though, I imagine you would have to synchronize it yourself.
Redis's lpush, and rpop plus some naming scheme might suffice. Everything is atomic, so the thread bit is covered.
Re: Write Fast Apps Using Async Python 3.6 and Redis
#29>>> The performance of uvloop-based asyncio is close to that of Go programs. I would prefer standard benchmarks for this. I hope they submit their framework to TechEnpower benchmarks. https://www.techempower.com/benchmarks/