[openstack-dev] Asynchrounous programming: replace eventlet with asyncio

victor stinner victor.stinner at enovance.com
Tue Feb 4 20:38:21 UTC 2014


Kevin Conway wrote:
> Switching our async IO management from eventlet to asyncio would not be a
> trivial task. Tell me when I'm wrong, but it would require that we
> completely change our programming model from typical, function-call based
> programming to use generator-iterators for everything.

My proposition is to put asyncio on top of greenlet using the greenio project. So the current code can be leaved unchanged (it will continue to eventlet) if you don't want to modify it. New code may use asyncio API instead of greenlet/eventlet API, but the code will still be executed by greenlet. Or you may have different implementations of the same feature, one for eventlet and another for asyncio.

For example, the Oslo Messaging project has an abstraction of the asynchronous framework called "executor". So you can use a blocking executor, eventlet, trollius or something else. Today, a patch was proposed by Joshua Harlow (*) to support concurrent.futures to use a pool of thread. I don't know yet how asyncio can be integrated in other projects. I'm just starting with Oslo Messaging :-)

The abstraction layer may be moved from Oslo Messaging to Oslo Incubator, so other projects can reuse it.

(*) "Start adding a futures executor based executor", https://review.openstack.org/#/c/70914/

Victor



More information about the OpenStack-dev mailing list