gevent: gunicorn vs uWSGI

2012-10-22 10:41:19 +08:00
 phuslu
http://ivan-site.com/2012/10/gevent-gunicorn-vs-uwsgi/

推荐一下, 我觉得结果比较可信, 和我在实际项目感受的结果一致.
也是为数不多的测试 uwsgi+gevent 性能的一个 bechmark.
13505 次点击
所在节点    Python
6 条回复
phuslu
2012-10-22 10:43:37 +08:00
uwsgi 现在已经支持 gevent 作为 LoopEngine, 不知道大家有没有人在用
http://projects.unbit.it/uwsgi/wiki/Gevent
phuslu
2012-10-22 10:45:17 +08:00
最后一段作者结论, 我比较认同 :-)

"""
As you can see, the results are pretty close with uWSGI having a slight edge in throughput in some cases and gunicorn having a slight advantage in request times. I think we can safely conclude that most of the work is being handled by gevent in this benchmark, so the server doesn’t actually play a huge role in performance. That being said, gunicorn is a lot easier to install as it doesn’t need manual compilation or beta versions of gevent.
"""
phuslu
2012-10-22 10:50:46 +08:00
事实上, gunicorn 调用 gevent workers 的代码类似这样的原理(uwsgi+gevent 也是差不多的做法).
http://gist.github.com/3928092
gunicorn 是非常值得尝试的. :)
CMGS
2012-10-22 11:09:31 +08:00
gunicorn目前在用,很“实用性”的server,相对于性能逆天的bjoern,gunicorn在提供稳定支持的情况下能最大的利用CPU和用不同Type的Worker去提升性能。uWSGI的问题在于1)源码太乱(导致bjoern出生)2)Hack的话不如Gunicorn方便。3)性能没太多亮点,一个C的和一个纯Python的几乎一致,何苦呢。

而fapws3也有类似的问题,性能/扩展性/进程管理,这又是另外一堆内容了……

而Gevent,也是“实用性”的异步网络层框架,理由很简单,无论是bug性能级的meinheld还是类似的eventlet,第三方库的支持很重要,而gevent这一点上做得不错,包括我们现在做的活,很容易移植一个项目基于gevent异步起来。

至于异步是否是最优,这又是另外一段内容了……挨踢技术横竖都是回归型的……

最后吐槽一下Gevent 1.0b4,各种坑……不要轻易尝试吧,改subprocess,fileobj,os这几个核心模块的monkey不是那么容易完成的,1.0b3相对稳定一些。
phuslu
2012-10-22 11:32:06 +08:00
@CMGS
嗯. bjoern/fapws3/meinheld 都不够完备, 只能算一个 wsgi server.
gevent 就好多了, 1.0b4 多了 subprocess/fileobject 也是大势所趋.
CMGS
2012-10-22 11:34:55 +08:00
1.0b4坑太多了……dev版本都稳定些= =

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/50570

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX