We're using Twisted extensively for apps requiring a great deal of asynchronous io. There are some cases where stuff is cpu bound instead and for that we spawn a pool of processes to do the work and have a system for managing these across multiple servers as well - all done in Twisted. Works great. The problem is that it's hard to bring new team members up to speed. Writing asynchronous code in Twisted requires a near vertical learning curve. It's as if humans just don't think that way naturally.
我们正在为需要大量异步io的应用程序广泛使用Twisted。在某些情况下,东西是cpu绑定的,为此我们产生了一个进程池来完成工作,并且有一个系统来管理多个服务器上的这些 - 所有这些都是在Twisted中完成的。效果很好。问题是很难让新的团队成员加快速度。在Twisted中编写异步代码需要近乎垂直的学习曲线。就像人类自然不这么认为那样。
We're considering a mixed approach perhaps. Maybe keep the xmlrpc server part and process management in Twisted and implement the other stuff in code that at least looks synchronous to some extent while not being as such. Then again I like explicit over implicit so I have to think about this a bit more. Anyway onto greenlets - how well does that stuff work? So there's Stackless and as you can see from my Gallentean avatar I'm well aware of the tremendous success in it's use for CCP's flagship EVE Online game first hand. What about Eventlet or gevent? Well for now only Eventlet works with Twisted. However gevent claims to be faster as it's not a pure python implementation but rather relies upon libevent instead. It also claims to have fewer idiosyncrasies and defects. gevent It's maintained by 1 guy as far as I can tell. This makes me somewhat leery but all great projects start this way so... Then there's PyPy - I haven't even finished reading about that one yet - just saw it in this thread: Drawbacks of Stackless.
我们也许正在考虑采用混合方法。也许保持xmlrpc服务器部分和进程管理在Twisted中并在代码中实现其他东西,至少在某种程度上看起来是同步的,而不是这样。然后我再次明确过度暗示所以我必须多考虑一下这一点。无论如何,对于greenlets - 这些东西有多好?所以有Stackless,你可以从我的Gallentean头像中看到,我很清楚它在第一手使用CCP的旗舰EVE Online游戏方面取得了巨大的成功。那么Eventlet或gevent呢?好吧现在只有Eventlet与Twisted一起使用。然而gevent声称速度更快,因为它不是纯粹的python实现,而是依赖于libevent。它还声称具有较少的特性和缺陷。 gevent据我所知,它由1个人维护。这让我有点怀疑,但是所有伟大的项目都是这样开始的......那么就是PyPy - 我还没有读完那篇文章 - 只是在这个帖子中看到它:Stackless的缺点。
So confusing - I'm wondering what the heck to do - sounds like Eventlet is probably the best bet but is it really stable enough? Anyone out there have any experience with it? Should we go with Stackless instead as it's been around and is proven technology - just like Twisted is as well - and they do work together nicely. But still I hate having to have a separate version of Python to do this. what to do....
如此令人困惑 - 我想知道该怎么做 - 听起来像Eventlet可能是最好的选择,但它真的足够稳定吗?那里有人有经验吗?我们应该选择Stackless,因为它已经存在并且是经过验证的技术 - 就像Twisted一样 - 并且它们可以很好地协同工作。但我仍然不想让一个单独的Python版本来做到这一点。该怎么办....
This somewhat obnoxious blog entry hit the nail on the head for me though: Asynchronous IO for Grownups I don't get the Twisted is being like Java remark as to me Java is typically where you are in the threading mindset but whatever. Nevertheless if that monkey patch thing really works just like that then wow. Just wow!
这个有点令人讨厌的博客文章对我来说很重要但是:Grownups的异步IO我没有得到Twisted就像Java一样对我而言Java通常是你处于线程思维中的地方,但无论如何。然而,如果那个猴子补丁的东西真的像那样工作那么哇。哇哇!
4 个解决方案
#1
28
You might want to check out:
您可能想要查看:
- Comparing gevent to eventlet
- 将gevent与eventlet进行比较
- Reports from users who moved from twisted or eventlet to gevent
- 来自twisted或eventlet的用户报告到gevent
Eventlet and gevent are not really comparable to Stackless, because Stackless ships with a standard library that is not aware of tasklets. There are implementations of socket for Stackless but there isn't anything as comprehensive as gevent.monkey. CCP does not use bare bones Stackless, it has something called Stackless I/O which AFAIK is windows-only and was never open sourced (?).
Eventlet和gevent与Stackless并不具有可比性,因为Stackless附带了一个不知道tasklet的标准库。 Stackless的套接字实现,但没有像gevent.monkey那样全面的东西。 CCP不使用裸骨Stackless,它有一种称为Stackless I / O的东西,AFAIK只是windows,而且从来没有开源(?)。
Both eventlet and gevent could be made to run on Stackless rather than on greenlet. At some point we even tried to do this as a GSoC project but did not find a student.
eventlet和gevent都可以在Stackless上运行而不是在greenlet上运行。在某些时候,我们甚至尝试将其作为GSoC项目,但没有找到学生。
#2
4
Answering part of your question - if you look at http://speed.pypy.org you'll see that using twisted on top of PyPy may give you some speedups. This depends of course on your workload, but it's probably worth checking out.
回答你问题的一部分 - 如果你看一下http://speed.pypy.org,你会发现在PyPy上使用twisted会给你带来一些加速。这当然取决于您的工作量,但可能值得一试。
Cheers,
fijal
干杯,fijal
#3
0
I've built a little real time web app on top of eventlet and repoze.bfg (I gave up on django quite a while ago). I've found eventlet and monkey patching to be just as easy as Ted says.
我在eventlet和repoze.bfg之上构建了一个小实时web应用程序(我很久以前就放弃了django)。我发现eventlet和猴子修补就像Ted说的一样容易。
#4
#1
28
You might want to check out:
您可能想要查看:
- Comparing gevent to eventlet
- 将gevent与eventlet进行比较
- Reports from users who moved from twisted or eventlet to gevent
- 来自twisted或eventlet的用户报告到gevent
Eventlet and gevent are not really comparable to Stackless, because Stackless ships with a standard library that is not aware of tasklets. There are implementations of socket for Stackless but there isn't anything as comprehensive as gevent.monkey. CCP does not use bare bones Stackless, it has something called Stackless I/O which AFAIK is windows-only and was never open sourced (?).
Eventlet和gevent与Stackless并不具有可比性,因为Stackless附带了一个不知道tasklet的标准库。 Stackless的套接字实现,但没有像gevent.monkey那样全面的东西。 CCP不使用裸骨Stackless,它有一种称为Stackless I / O的东西,AFAIK只是windows,而且从来没有开源(?)。
Both eventlet and gevent could be made to run on Stackless rather than on greenlet. At some point we even tried to do this as a GSoC project but did not find a student.
eventlet和gevent都可以在Stackless上运行而不是在greenlet上运行。在某些时候,我们甚至尝试将其作为GSoC项目,但没有找到学生。
#2
4
Answering part of your question - if you look at http://speed.pypy.org you'll see that using twisted on top of PyPy may give you some speedups. This depends of course on your workload, but it's probably worth checking out.
回答你问题的一部分 - 如果你看一下http://speed.pypy.org,你会发现在PyPy上使用twisted会给你带来一些加速。这当然取决于您的工作量,但可能值得一试。
Cheers,
fijal
干杯,fijal
#3
0
I've built a little real time web app on top of eventlet and repoze.bfg (I gave up on django quite a while ago). I've found eventlet and monkey patching to be just as easy as Ted says.
我在eventlet和repoze.bfg之上构建了一个小实时web应用程序(我很久以前就放弃了django)。我发现eventlet和猴子修补就像Ted说的一样容易。