在生产中,Apache + mod_wsgi 还是 Nginx + mod_wsgi? [英] In production, Apache + mod_wsgi or Nginx + mod_wsgi?

查看:38
本文介绍了在生产中,Apache + mod_wsgi 还是 Nginx + mod_wsgi?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大中型python WSGI应用程序使用什么,Apache + mod_wsgi或Nginx + mod_wsgi?

哪种组合需要更多内存和 CPU 时间?
哪个更快?
哪个以比另一个更稳定而闻名?

我也在考虑使用 CherryPy 的 WSGI 服务器,但我听说它不太适合非常高负载的应用程序,您对此了解多少?

注意:我没有使用任何 Python Web 框架,我只是从头开始编写了整个内容.
注意:也欢迎其他建议.

What to use for a medium to large python WSGI application, Apache + mod_wsgi or Nginx + mod_wsgi?

Which combination will need more memory and CPU time?
Which one is faster?
Which is known for being more stable than the other?

I am also thinking to use CherryPy's WSGI server but I hear it's not very suitable for a very high-load application, what do you know about this?

Note: I didn't use any Python Web Framework, I just wrote the whole thing from scratch.
Note': Other suggestions are also welcome.

推荐答案

对于 nginx/mod_wsgi,请务必阅读:

For nginx/mod_wsgi, ensure you read:

http://blog.dscpl.com.au/2009/05/blocking-requests-and-nginx-version-of.html

由于 nginx 是底层的事件驱动系统,因此它具有不利于阻塞应用程序的行为特征,例如基于 WSGI 的应用程序的情况.更糟糕的情况是,使用多进程 nginx 配置,即使某些 nginx 工作进程可能空闲,您也可以看到用户请求被阻止.Apache/mod_wsgi 没有这个问题,因为 Apache 进程只有在拥有实际处理请求的资源时才会接受请求.Apache/mod_wsgi 将因此提供更可预测和更可靠的行为.

Because of how nginx is an event driven system underneath, it has behavioural characteristics which are detrimental to blocking applications such as is the case with WSGI based applications. Worse case scenario is that with multiprocess nginx configuration, you can see user requests be blocked even though some nginx worker processes may be idle. Apache/mod_wsgi doesn't have this issue as Apache processes will only accept requests when it has the resources to actually handle the request. Apache/mod_wsgi will thus give more predictable and reliable behaviour.

这篇关于在生产中,Apache + mod_wsgi 还是 Nginx + mod_wsgi?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆