Apache2 似乎很忙

Apache2 似乎很忙

我正在Ubuntu 14.04.4 LTS运行一个服务器Apache/2.4.7,并且我的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

有什么需要帮助的吗?非常感谢您的耐心和支持。

答案1

日志和 shell 输出与生效的 apache 配置不一致。指令

MinSpareServers 30 

这意味着每次至少会有 30 个 Apache 子进程运行,并且只要该数量大于需要生成的数量,就不会出现该错误消息。

确认正在编辑的配置文件实际上是 apache 正在使用的配置文件,例如尝试

httpd -t -D DUMP_INCLUDES

或者检查 -f 参数的使用,指定不同的父配置文件。

相关内容