If it’s your first time to Eventlet, you may find the illuminated examples in the Design Patterns document to be a good starting point.

Eventlet is built around the concept of green threads (i.e. coroutines, we use the terms interchangeably) that are launched to do network-related work. Green threads differ from normal threads in two main ways:

  • Green threads are so cheap they are nearly free. You do not have to conserve green threads like you would normal threads. In general, there will be at least one green thread per network connection.

  • Green threads cooperatively yield to each other instead of preemptively being scheduled. The major advantage from this behavior is that shared data structures don’t need locks, because only if a yield is explicitly called can another green thread have access to the data structure. It is also possible to inspect primitives such as queues to see if they have any pending data.


在加锁、信号量、CAS大行其道的年代,又有多少人会记得协程这种简单货。


http://eventlet.net/doc/index.html