我有一个运行Apache/2.4.7的Ubuntu 14.04.4 LTS服务器,我的error.log文件经常会在下面得到这样的消息:
[Thu Sep 01 19:45:40.571637 2016] [mpm_prefork:info] [pid 1696] AH00162: server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 8 children, there are 3 idle, and 17 total children [Thu Sep 01 19:47:03.699939 2016] [mpm_prefork:info] [pid 1696] AH00162: server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 8 children, there are 4 idle, and 17 total children [Thu Sep 01 19:48:35.856132 2016] [mpm_prefork:info] [pid 1696] AH00162: server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 8 children, there are 2 idle, and 20 total children
我已经改变了我的apache2.conf ,它看起来像下面这样:
# 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 # MaxRequestWorkers: maximum number of server processes allowed to start (was: MaxClients) # MaxConnectionsPerChild: maximum number of requests a server process serves (was: MaxRequestsPerChild) <IfModule mpm_prefork_module> StartServers 100 MinSpareServers 30 MaxSpareServers 60 ServerLimit 400 MaxRequestWorkers 400 MaxConnectionsPerChild 10000 </IfModule>
重新启动apache2后,错误仍然保持不变。
我的服务器没有内存不足,CPU使用率( htop输出看起来相当不错)。
另外,我在执行netstat和ps时得到了这些结果:
ubuntu@php-app1:~$ sudo netstat -pant | grep -c ESTABLISHED
18
ubuntu@php-app1:~$ ps -ef | grep -ic apache2
17
请帮忙吗? 非常感谢您的耐心和支持。
日志和shell输出与该configuration生效不一致。 指令
MinSpareServers 30
这意味着一次至less有30个apache儿童在运行,只要这个数字大于需要产生的数量,那么这个错误信息就不会出现。
确认正在编辑的configuration文件实际上是由apache使用的configuration文件,例如尝试
httpd -t -D DUMP_INCLUDES
或者检查是否使用-f参数,指定不同的父configuration文件。