Hacker News new | ask | show | jobs
by markitechtMA 5715 days ago
I wonder how it might compare to Tornado (http://www.tornadoweb.org/)
2 comments

Here's a blog post from several months ago: http://nichol.as/benchmark-of-python-web-servers

Gevent uses the http server built into libevent, which is written in C, so it's no surprise that it is fast.

I love Tornado personally, but I wanted to write synchronous code.

Eventlet (the project that Gevent forked from) allows you to write hubs while gevent only supports the libevent hub. So I made http://github.com/vishnevskiy/greentornado to allow Eventlet to run on Tornado's IOLoop. Been working for a while in production with no issues.

Would have made it for gevent though if I could since after reading the code of gevent and Eventlet I found that gevent's code base was much cleaner.

The creators of Tornado recommend writing synchronous code for everything except "long" operations for which you have no control. Examples of these include long polling and requests to third party services. Requests to your local database are not long operations. If these requests are long operations, then you have a latency problem with your application.

The Tornado people recommend running more instances of the application than CPUs to handle the short blocking requests to local databases and what not.

Although it depends on what your app does, my guess is that typical applications written with this philosophy are mostly synchronous code.

With eventlet and gevent you can write asynchronous that looks synchronous. Which is the point of greentornado.

That being said we still use synchronous calls to our databases.

^ This is really good stuff. Writing synchronous code for async programs really helps with maintainability.