Gevent with a message broker?

83 views
Skip to first unread message

Zsolt Ero

unread,
Aug 31, 2017, 7:29:02 AM8/31/17
to gevent: coroutine-based Python network library
I am developing an real-time, location-based iOS mobile app which would use a Python based backend. So far I only have experience with blocking / sync Python code, like the standard gunicorn worker with Pyramid / Django.

For this project I looked into using async Python frameworks / clients (asyncio / twisted, official Autobahn|Python backends), but they would require me to abandon all the libraries I already know and use, for example SQLAlchemy ORM. If I understand it right, gevent would allow using such libraries, after monkey patching, is that right?

Would using gevent allow me to:
- Have concurrent, slow running queries on HTTP endpoints, for example those which call 3rd party services via services?
- Allow me to use a message broker to handle connections with mobile devices (I was thinking about MQTT or WAMP/Crossbar.io) and serve as the backend while keeping my sync libraries, like SQLAlchemy ORM?



Jason Madden

unread,
Aug 31, 2017, 7:33:24 AM8/31/17
to gev...@googlegroups.com

> On Aug 31, 2017, at 06:22, Zsolt Ero <zsol...@gmail.com> wrote:
>
> If I understand it right, gevent would allow using such libraries, after monkey patching, is that right?

That's the idea, yes.


> Would using gevent allow me to:
> - Have concurrent, slow running queries on HTTP endpoints

Yes, that's the idea.

> - Allow me to use a message broker to handle connections with mobile devices (I was thinking about MQTT or WAMP/Crossbar.io)

I don't know anything about those particular libraries. If they're standard Python libraries that don't use C extensions, don't use asyncio, and just operate at the normal Python socket layer, odds are that they will be compatible with gevent monkey-patching. YMMV.

~Jason
Reply all
Reply to author
Forward
0 new messages