Hi,

FYI I posted the second version of my specification to replace
eventlet with asyncio in OpenStack:
https://review.openstack.org/#/c/153298/2/specs/asyncio.rst

OpenStack is not the perfect world dreamed by developers, but more the
cold and sad real world where the production matters more than new
shiny technologies :-) No (full) Python 3 support yet, eventlet used
with monkey-patching, SQLAchmey and WSGI are heavily used, etc.

Problems:

- asyncio requires Python 3.3 => trollius

- WSGI protocol is not compatible with asyncio => servers using WSGI
are excluded of the spec yet

- SQLAchemy doesn't support asyncio. The SQLAchemy maintainer doesn't
look to be interested to support asyncio. He prefers to use native
threads with blocking code. => workaround: call SQLAchemy in
run_in_executor()

- switching to asyncio has a large impact on the code, it requires a
lot of manpower => some developers would prefer to not change
anything, use threads, or something else

- some developers are not convinced that explicit async programming
reduces the risk of race condition compared to implicit async
programming => I added a new section in the spec to explain my point

- the performance impact is unknown at this stage => I used API Hour
benchmark, since it's the only available public benchmark on asyncio

- developers will now have to learn how to write asyncio code.
Currently, OpenStack uses eventlet with monkey-patching, there is no
need to explicitly say that an operation is blocking (that's the whole
purpose of monkey-patching/implicit async).

- few libraries support asyncio, but even fewer support trollius.
should libraries support asyncio and trollius?

- etc.

So it's an interesting challenge to see how eventlet can (or cannot?)
be replaced in OpenStack.

For the performance impact, Michael Brayer (SQLAchemy maintainer) used
a microbenchmark to say that coroutines are 600% slower than classic
Python function calls. I modified his benchmark and uploaded it at:
https://bitbucket.org/haypo/asyncio_staging/src/2f89fbdc7c12bd2541071648018ab9d484d79703/bench_ge
nerator.py

Michael looks to trust more his microbenchmark than API Hour benchmark
running a whole HTTP server which connects to a PostgreSQL database.
Ludovic Gasc replied to Michael about the API Hour benchmark. I didn't
read his reply yet. See comments on the first version on my spec
(search for "Hour"):
https://review.openstack.org/#/c/153298/1/specs/asyncio.rst

Victor

Reply via email to