简体   繁体   English

在守护进程模式下调整mod_wsgi

[英]Tuning mod_wsgi in daemon mode

I'm running wsgi application on apache mod_wsgi in daemon mode. 我在守护进程模式下运行apache mod_wsgi上的wsgi应用程序。 I have these lines in the configuration 我在配置中有这些行

WSGIDaemonProcess app processes=2 threads=3 display-name=%{GROUP} 
WSGIProcessGroup app

How do I find the optimal combination/tuning of processes and threads? 如何找到进程和线程的最佳组合/调优?

EDIT : This link [given in answer bellow] was quite usefull: https://serverfault.com/questions/145617/apache-2-2-mpm-worker-more-threads-or-more-processes/146382#146382 编辑 :此链接[在下面的回答中给出]是非常有用的: https//serverfault.com/questions/145617/apache-2-2-mpm-worker-more-threads-or-more-processes/146382#146382

Now, my question is this: If my server gives quite good performance for my needs, should I reduce the number of threads to increase stability / reliability? 现在,我的问题是:如果我的服务器为我的需求提供了相当好的性能,我应该减少线程数以提高稳定性/可靠性吗? Can I even set it to 1? 我可以把它设置为1吗?

You might get more information on ServerFault as well. 您也可以获得有关ServerFault的更多信息。 For example: https://serverfault.com/questions/145617/apache-2-2-mpm-worker-more-threads-or-more-processes 例如: https//serverfault.com/questions/145617/apache-2-2-mpm-worker-more-threads-or-more-processes

This is another good resource for the topic: http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading#The_mod_wsgi_Daemon_Processes which briefly describes the options -- including setting threads = 1. 这是该主题的另一个很好的资源: http//code.google.com/p/modwsgi/wiki/ProcessesAndThreading#The_mod_wsgi_Daemon_Processes ,其中简要介绍了这些选项 - 包括设置threads = 1。

I haven't done this yet but it sounds like it doesn't much matter. 我还没有这样做,但听起来并不重要。 Supporting multiple threads as well as multiple processors are both well supported. 支持多个线程以及多个处理器都得到了很好的支持。 But for my experience level (and probably yours) its worthwhile to eliminate threading as an extra source of concern -- even if it is theoretically rock solid. 但是对于我的经验水平(可能是你的经验水平)来说,将线程作为一个额外的关注来源是有价值的 - 即使它在理论上是坚如磐石的。

Your best bet is to probably try different bench marks. 你最好的选择是尝试不同的替补标记。 You can use the apache benchmark command to get a rough estimate at how your configuration is doing. 您可以使用apache benchmark命令粗略估计配置的运行情况。 A lot of the tweaking is going to depend on how CPU / IO bound your web app is. 很多调整将取决于您的Web应用程序的CPU / IO绑定方式。 The performance is also going to depend on the specs of the server you are hosting on etc. 性能也取决于您托管的服务器的规格等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM