Also note that David Beazley (google him if you're not aware) has a competitor to asyncio, which arguably is also a direct competitor to this called curio: http://curio.readthedocs.io/en/latest/ The caveat is that it uses the new async/await coroutine bits that just landed in Python 3.5, so it only works with Python 3.5+. He also gave a talk on concurrency in python recently at last year's PyCon: https://www.youtube.…
Uvloop: Fast Python networking
21–30 of 132 posts
Re: Uvloop: Fast Python networking
#22I'm the dev behind uvloop. AMA.
do you have perf benchmarks under heavier concurrency? (e.g., how does it do with 100 concurrent clients? 1000?)
[1] http://magic.io/blog/uvloop-blazing-fast-python-networking/h...
Re: Uvloop: Fast Python networking
#23This is quite interesting, but I don't find req/sec very interesting at all. These should be about matters of concurrency, that is, how much is being done at once, not how many req/sec overall are done (which could almost be explained away purely by the gains in lower latency). These benchmarks seem to only use 10 clients concurrently, max. That's ridiculously low. A few questions I'd like to see answered. How many c…
> These benchmarks seem to only use 10 clients concurrently, max. That's ridiculously low. I've just update the post with more details on HTTP benchmarks and attached the correct full-results file [1]. The concurrency level for HTTP benchmarks is 300, not 10. To answer other questions, I'll have to run some benchmarks tomorrow :) [1] http://magic.io/blog/uvloop-blazing-fast-python-networking/h...
In my experience, PyPy+twisted is around 5-25x faster CPython/twisted, and smoked asyncio as well. Would be great to see how uvloop compares there, and of course, someday when PyPy supports Python 3.5, there's no reason it couldn't use uvloop via cffi I'd hope.
Re: Uvloop: Fast Python networking
#24What exactly is the -streams addition that makes uvloop-streams perform so much worse than plain uvloop?
Re: Uvloop: Fast Python networking
#25Also note that David Beazley (google him if you're not aware) has a competitor to asyncio, which arguably is also a direct competitor to this called curio: http://curio.readthedocs.io/en/latest/ The caveat is that it uses the new async/await coroutine bits that just landed in Python 3.5, so it only works with Python 3.5+. He also gave a talk on concurrency in python recently at last year's PyCon: https://www.youtube.…
Re: Uvloop: Fast Python networking
#26Earlier quoted context omitted.
> These benchmarks seem to only use 10 clients concurrently, max. That's ridiculously low. I've just update the post with more details on HTTP benchmarks and attached the correct full-results file [1]. The concurrency level for HTTP benchmarks is 300, not 10. To answer other questions, I'll have to run some benchmarks tomorrow :) [1] http://magic.io/blog/uvloop-blazing-fast-python-networking/h...
Cool! For the client test I'm referring to, these would be long-lived clients that stay around and just TCP ping for an echo server, rather than HTTP calls that connect/disconnect. In my experience, PyPy+twisted is around 5-25x faster CPython/twisted, and smoked asyncio as well. Would be great to see how uvloop compares there, and of course, someday when PyPy supports Python 3.5, there's no reason it couldn't use uvl…
Yep, I'm curious to see what will happen there. Do you have any suggestions on what tool to use to generate the load?
> [..] someday when PyPy supports Python 3.5, there's no reason it couldn't use uvloop via cffi I'd hope.
We'll figure that out! ;)
Re: Uvloop: Fast Python networking
#27Re: Uvloop: Fast Python networking
#28Earlier quoted context omitted.
> at least 2x faster than nodejs, gevent, as well as any other Python asynchronous framework I did not see any benchmarks in the repo to support this. How was this statistic determined?
Building on to this, how does it compare to raw libuv in c?Personally, I'm not surprised that python (especially cython) is faster than node in this case, but I still need to see how much less overhead there is to node.
Building something in C is very hard. uvloop wraps all libuv primitives in Python objects which know how to manage the memory safely (i.e. not to "free" something before libuv is done with it). So development time wise, uvloop is much better.
As for the performance, I guess you'd be able to squeeze another 5-15% if you write the echo server in C.
> I'm not surprised that python (especially cython) is faster than node in this case
Cython is a statically typed compiled language, it can be anywhere from 2x to 100x faster than CPython.
Re: Uvloop: Fast Python networking
#29I'm the dev behind uvloop. AMA.
Re: Uvloop: Fast Python networking
#30I'm the dev behind uvloop. AMA.
1) What makes uvloop which is based on libuv 2x faster than node.js which is also based on libuv? 2) Can uvloop be used with frameworks like flask or django? 3) gevent uses monkey patching to turn blocking libraries such as DB drivers non-blocking, does uvloop do anything similar? If not how does it work with blocking libraries?
2) No, they have a different architecture. Although I heard that there is a project to integrate asyncio into django to get websockets and http/2.
3) asyncio/uvloop require you to use explicit async/await. So, unfortunately, the existing networking code that isn't built for asyncio can't be reused. On the bright side, there are so many asyncio DB drivers and other modules now!