我的生产网站上有一个Debian Linux VPS服务器(512MB)。
我使用Apache的Phusion Passenger来为Ruby 1.9的Rails 2.3.4应用程序提供服务。 我将Phusion乘客实例池限制为3个
尽pipestream量相对较低,但服务器有时会崩溃,我注意到(使用'top'命令时)有很多apache实例(/ usr / sbin / apache2 -k start),可能其中有20个占用了所有记忆我和网站变得无法响应。
我不知道该怎么做,从哪里开始挖掘潜在的问题,或者如何发现或限制apache实例的数量。
谢谢,
谭
这将是你的MPM设置。 你在一个* nix盒子,所以它可能是Prefork,你可以通过运行httpd -l(或在Ubuntu的奇怪的是它的apache2 -l)来validation,看看编译模块。
你想要到你的httpd.conf(或apache2.conf取决于你的设置),并为你的MPM工作人员编辑适当的configuration,以适应你的环境。
编辑:
你正在运行prefork mpm,但是prefork.c被编译进去了。你会想要进入/etc/apache2/apache2.conf(我只有Ubuntu的机器可以检查,但是因为它是Debian的衍生工具是相同的)。
您会find如下所示的部分。 编辑这些值。
# prefork MPM # StartServers: number of server processes to start # MinSpareServers: minimum number of server processes which are kept spare # MaxSpareServers: maximum number of server processes which are kept spare # MaxClients: maximum number of server processes allowed to start # MaxRequestsPerChild: maximum number of requests a server process serves <IfModule mpm_prefork_module> StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 150 MaxRequestsPerChild 0 </IfModule>