Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twisted, gevent eventlet - When would I use them

Under what circumstances would something like eventlet/gevent be better than twisted? Twisted seems like the most used, but eventlet/gevent must have some advantages... I'm not looking for an answer to a specific scenario, just generalities.

like image 303
Varriount Avatar asked Dec 10 '10 04:12

Varriount


1 Answers

It's an issue of aesthetic preference, I think.

First of all, eventlet can actually use Twisted for networking, so in a sense, it's not an either-or question, it's a this-is-built-on-top-of-that question.

Personally, I don't see the need for libraries like gevent or eventlet, especially since the advent of the @inlineCallbacks decorator in Twisted, which already write code which sorta looks like it's blocking.

But, if you have a large library of code which already uses threads, and you want to port it to be event-driven, something like eventlet can save you some typing, since you don't need to insert 'yield's everywhere.. Some people, like the guys behind the EVE online game, think that code written in this style is just better for some things, such as AI code.

like image 116
Glyph Avatar answered Nov 12 '22 15:11

Glyph