Differences between gevent and tornado

treecoder picture treecoder · Oct 10, 2012 · Viewed 9.8k times · Source

I understand that both tornado and gevent are asynchronous python frameworks.

While reading the bottle documentation I found that gevent actually is NOT asynchronous, and you can create thousands to pseudo-threads that work synchronously.

Seondly, in gevent, you can not terminate the request handler early and you need to return the full response, while in tornado you can. (correct me if I'm wrong here)

Can some one describe in detail how these systems work internally, and in what ways they are different. Also, how does WSGI play with the asynchronous nature of these systems? Do these frameworks conform to WSGI, if yes, how?

Answer

Graham Dumpleton picture Graham Dumpleton · Oct 10, 2012

Have a read of:

http://en.wikipedia.org/wiki/Coroutines

and:

http://en.wikipedia.org/wiki/Event-driven_architecture

http://en.wikipedia.org/wiki/Event-driven_programming

The gevent package uses coroutines and Tornado is event driven.

Even driven systems don't readily map to WSGI, but a coroutine system, because it looks like threads, can be made to support WSGI if blocking points can be patched to switch coroutines when things would block.