Eventlet vs Greenlet vs gevent?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
greenlet, gevent, and Eventlet are related, but they are not interchangeable. greenlet is the low-level coroutine primitive, while gevent and Eventlet are higher-level cooperative I/O frameworks built on top of that idea. The practical choice today depends less on raw capability and more on how much legacy green-thread code you already have.
Start With greenlet: The Primitive Layer
The greenlet project describes greenlets as lightweight coroutines for in-process concurrent programming. A greenlet does not provide an event loop, network stack, or scheduler by itself. It only gives you manual control over switching execution.
This is powerful, but it is also very low level. You typically use greenlet directly when building frameworks or advanced control-flow machinery, not when you just want a practical networking stack.
What gevent Adds
gevent builds a cooperative concurrency framework on top of greenlets and an event loop. Its documentation describes it as a coroutine-based Python networking library that uses greenlet to provide a high-level synchronous API on top of the libev or libuv event loop.
That means gevent is not just "greenlet plus helpers." It adds:
- an event loop
- cooperative sockets and DNS
- greenlet spawning APIs
- synchronization primitives
- optional monkey patching for standard-library I/O
This is the kind of code people usually mean when they say they want green-threaded I/O in Python.
What Eventlet Adds
Eventlet occupies a similar space: cooperative networking and green threads built around non-blocking I/O. Historically it was a popular way to write concurrent network services without native async and await syntax.
However, current Eventlet documentation now explicitly discourages new usage. The project warns that new usages are heavily discouraged and recommends asyncio for new async network programming, while positioning Eventlet in maintenance mode with a migration path for existing users.
That changes the recommendation significantly.
Practical Differences That Matter
The easiest way to compare them is by layer:
- '
greenlet: low-level coroutine switching primitive' - '
gevent: full cooperative I/O framework usinggreenlet' - Eventlet: another cooperative I/O framework using green threads, now oriented toward maintenance and migration rather than new adoption
In other words, greenlet is the foundation. gevent and Eventlet are frameworks that solve a larger problem.
gevent documentation also notes that it was inspired by Eventlet, but presents itself as having a more consistent API and simpler implementation. For teams already committed to the greenlet-based ecosystem, that makes gevent the more common modern choice between the two high-level libraries.
Which One Should You Choose
For a new Python service, the default answer should usually be asyncio, not any of these three. That is not because gevent or greenlet are broken. It is because asyncio is the standard library async model and integrates more naturally with current Python tooling.
If you are maintaining an existing greenlet-based stack:
- choose
greenletonly when you need a low-level primitive or are building infrastructure - choose
geventwhen you want a mature cooperative I/O framework in an existing greenlet-style architecture - keep Eventlet mainly for legacy code that already depends on it, with migration planning in mind
That is a more useful decision rule than comparing them as if they were three equal alternatives.
Common Pitfalls
The most common mistake is treating greenlet as a drop-in substitute for gevent or Eventlet. It is not. It gives you switching primitives, not a networking framework.
Another problem is recommending Eventlet for new projects without acknowledging its current maintenance stance. That advice is outdated.
Developers also often underestimate monkey patching. Both high-level frameworks can rely on cooperative replacements for blocking APIs, and that can interact badly with libraries that assume standard behavior.
Finally, do not confuse cooperative concurrency with parallel CPU execution. These libraries are strongest for I/O-bound workloads, not for CPU-bound scaling.
Summary
- '
greenletis the low-level coroutine primitive.' - '
geventis a higher-level cooperative I/O framework built ongreenlet.' - Eventlet is a similar framework, but its current docs discourage new usage and emphasize migration.
- For new Python async applications,
asynciois usually the better default. - Use
geventor Eventlet mainly when you are working within an existing green-threaded stack.

