本文介绍了Apache的mod_php,并且OR的FastCGI?这有利于字preSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对像mod_php的,CGI,FastCGI的等不同的配置运行PHP的基本理念。

在我的调查结果和试验,我发现FastCGI的稍微好一点。我喜欢的FastCGI的了suEXEC大多数的支持。等一下,我不想进入标杆企业在这里再次。如果你上网浏览,你会发现人们证明方法之一是在每秒处理的请求数量方面比另一种更快。那么其良好的指标,但我感兴趣的不同因素,这里是我的问题...


  1. 哪些运行PHP的方法消耗较少的内存?

  2. 此外哪种方法消耗内存几乎不变。我看到有300MB和800MB,每隔几秒钟之间mod_php,并且我的服务器内存使用率波动。

  3. 但是FastCGI的,从服务器中第一个响应来自很晚。我FastCGI的看到有在每个网页请求的初始延迟。一旦从服务器首先响应到达,其他项目,如图像,CSS,JS负荷pretty更快。

  4. 是否确定同时运行的组合?我有专门的服务器上的5个站点。它是确定,如果我跑几个与mod_php,并且和FastCGI的?休息

  5. 我相信我的服务器宕机,因为不当mod_php,并且内存使用量的下降居多。我检查了所有的脚本。有没有什么办法让服务器确保内存消耗保持几乎不变的?

  6. 的.htaccess是否复杂影响内存使用情况显著?如果是的话,它可以是一个单一的理由让服务器运行内存不足?

  7. 是否阿帕奇MPM prefork /工人设置会影响内存消耗?难道他们影响mod_php,并且和FastCGI模式一样?

  8. 当我运行顶命​​令,我看到阿帕奇(httpd的)消耗40MB左右的内存。还有的httpd运行多个实例。此外,在除了FastCGI的叉类似规模的一些过程。什么是httpd进程普通内存的大小?

  9. 当我运行在所有我们网站的话语preSS,这将是在这方面好办法?

  10. 是否FastCGI的/的SuExec正常工作与APC?我是否需要重新配置APC与suEXEC的和FastCGI工作。

请注意,我在对生存或DIGG流量高峰不感兴趣。我想一个办法,可以使服务器稳定,predictable。

很抱歉,如果我是混乱的,但我真的一塌糊涂。我有512MB的物理内存,400MB交换和我的服务器正在运行的内存像疯了似的。平均内存要求是350MB左右,它只是内存使用峰值使得几秒钟内存不可用,如果那几个第二个窗口中获得一些额外的命中,阿帕奇坠毁而MySQL和其他所有的小伙子们继续运行正常。

请帮我家伙。我不是要去购买更多的RAM或硬件。我该死的肯定问题出在我的配置。很抱歉,如果我听起来傲慢或​​无知的。


解决方案

I assume that per PHP-processed request they are more or less the same. But if you have mod_php loaded into apache serving images too, then I assume your memory footprint will be higher due to serving static files.

You can make both pretty constant. If you carefully set MaxClients, MinSpareServers and MaxSpareServers, you pretty much can tell how many processes are running. If you also set memory_limit within your PHP config, you can calculate how much memory you need.You can do the same for fcgi too, since you can decide how many processes are running.

This doesn't make sense. I am not sure why it happens in your case.

I guess, but it will both be a nightmare to maintain and will probably be harder to configure for saving memory. Quite the contrary I believe.

Configure memory and processes as I outlined above, and keep monitoring.

I don't think so. per-directory .htaccess can slow things down, but unless there is some serious bug in Apache, it should not cause mass memory consumption.

It might, but I recommend to stay away from worker, as PHP is mostly not thread safe.

30MB is the min. The upper limit depends on your application (I have seen cases where it was ~1GB)

It is probably a matter of taste. I have recently moved away from apache towards nginx+fastcgi. it takes a bit of time to get used to, but it does work well. No problems whatsoever with wordpress (even not with supercache, which is rather involved in terms of web server).

I am not using suExec, but fastcgi works well with APC. No need to configure anything.

这篇关于Apache的mod_php,并且OR的FastCGI?这有利于字preSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 20:58