我有一个非常繁忙的服务器: PHP (Wordpress)使用W3TotalCache APC、VarnieforApache和Cloudflare来处理所有流量。Ubuntu 14.04.4 LTS
只有一个网站的平均点击量约为60000次/天。
我时不时地收到这个消息,一天只收到几次。与临时流量高峰无关,我们比较了谷歌分析的时间。
Thu Apr 28 14:14:42.938075 2016] [mpm_prefork:error] [pid 19137] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
[Thu Apr 28 15:43:25.594147 2016] [core:notice] [pid 19137] AH00051: child pid 19866 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594313 2016] [core:notice] [pid 19137] AH00051: child pid 20386 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594407 2016] [core:notice] [pid 19137] AH00051: child pid 19143 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594498 2016] [core:notice] [pid 19137] AH00051: child pid 19144 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594572 2016] [core:notice] [pid 19137] AH00051: child pid 20597 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594642 2016] [core:notice] [pid 19137] AH00051: child pid 20395 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594704 2016] [core:notice] [pid 19137] AH00051: child pid 20424 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594785 2016] [core:notice] [pid 19137] AH00051: child pid 20598 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594870 2016] [core:notice] [pid 19137] AH00051: child pid 19861 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Thu Apr 28 15:43:25.594957 2016] [core:notice] [pid 19137] AH00051: child pid 19782 exit signal Segmentation fault (11), possible coredump in /etc/apache2
....
....
所以我先把MaxRequestWorkers提高到100,然后是500,现在是1024。但仍在发生。
这是我现在的apache2.conf。代码:
<IfModule mpm_worker_module>
StartServers 256
MinSpareThreads 256
MaxSpareThreads 256
MaxClients 256
ServerLimit 256
ThreadLimit 256
ThreadsPerChild 256
MaxRequestWorkers 1024
MaxConnectionsPerChild 0
MaxRequestPerChild 1000
</IfModule>
有大量的空闲RAM,负载平均约为0.5,有时超过1。但从未见过它高于2。因此,服务器似乎健康地处理流量。
top - 16:07:47 up 3 days, 18:18, 2 users, load average: 0.57, 0.46, 0.55
Tasks: 113 total, 1 running, 112 sleeping, 0 stopped, 0 zombie
%Cpu(s): 10.5 us, 2.0 sy, 0.0 ni, 87.4 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 8176816 total, 2372560 used, 5804256 free, 189684 buffers
KiB Swap: 0 total, 0 used, 0 free. 1286692 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
21930 www-data 20 0 337212 83308 60072 S 24.9 1.0 0:52.89 apache2
21945 www-data 20 0 327640 72684 58816 S 24.3 0.9 0:48.37 apache2
1182 nobody 20 0 702868 442268 83496 S 0.7 5.4 42:41.32 varnishd
知道Apache为什么打断我吗?
//j
发布于 2016-05-05 17:54:58
基本上,config被覆盖在: /etc/apache2/mods-available/mpm_prefork.conf中。
我将新设置放入该文件中,看来Apache现在工作正常了。
希望这有助于其他人,不要将您的配置放在apache2.conf或httpd.conf中。确保您更改了所有已加载的配置文件。
发布于 2017-09-12 09:39:50
你应该编辑mpm_prefork
<IfModule mpm_prefork_module>
StartServers 10
MinSpareServers 10
MaxSpareServers 20
ServerLimit 2000
MaxRequestWorkers 1500
MaxConnectionsPerChild 10000
</IfModule>
发布于 2017-08-04 10:19:14
你修改错文件了。您的日志显示"mpm_prefork“错误。因此,您需要修改mpm_prefork.conf而不是mpm_worker.conf。
您还可以使用"apachectl -M“来查看您正在使用的模块。我的apache2正在使用mpm_event_module,所以我需要修改mpm_event.conf
$ apache2ctl -M
Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
filter_module (shared)
mime_module (shared)
**mpm_event_module (shared)**
negotiation_module (shared)
setenvif_module (shared)
status_module (shared)
wsgi_module (shared)
https://stackoverflow.com/questions/36924952
复制相似问题