Apache AH16161:服务器达到Max RevestWork设置,考虑提高Max RevestWork设置

Apache AH16161:服务器达到Max RevestWork设置,考虑提高Max RevestWork设置,apache,ubuntu-14.04,Apache,Ubuntu 14.04,我有一个非常繁忙的服务器:PHP(Wordpress)使用W3TotalCache APC、Varnish for Apache和Cloudflare来处理所有流量。 Ubuntu 14.04.4 LTS 只有一个网站平均每天点击量约为6万次 我时不时地收到这个消息,一天几次。与暂时的流量高峰无关,我们将时间与谷歌分析进行了比较 Thu Apr 28 14:14:42.938075 2016] [mpm_prefork:error] [pid 19137] AH00161: server rea

我有一个非常繁忙的服务器:PHP(Wordpress)使用W3TotalCache APC、Varnish for Apache和Cloudflare来处理所有流量。 Ubuntu 14.04.4 LTS

只有一个网站平均每天点击量约为6万次

我时不时地收到这个消息,一天几次。与暂时的流量高峰无关,我们将时间与谷歌分析进行了比较

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。 代码:

知道Apache为什么会中断吗


//j

基本配置已在中被覆盖: /etc/apache2/mods可用/mpm_prefork.conf

我将新设置放在该文件中,现在看来Apache工作正常


希望这对其他人有所帮助,不要直接将配置放在apache2.conf或httpd.conf中。确保更改所有加载的配置文件。

您可能需要检查Web服务器访问日志。如果日志中充斥着xml rpc帖子(例如“POST/xmlrpc.php HTTP/1.1”200 403),您可能会成为xml rpc攻击的目标。有多种方法可以防止这种情况发生,但是Wordpress很容易发生这种情况。

您修改了错误的文件。您的日志显示“mpm\U预工作”错误。因此,您需要修改mpm_prefork.conf而不是mpm_worker.conf

您还可以使用“apachectl-M”查看您正在使用的模块。 e、 g.我的apache2正在使用mpm_event_模块,所以我需要修改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)

您应该编辑mpm\U prefork


StartServers 10
MinSpareServers 10
MaxSpareServers 20
服务器限制2000
MaxRequestWorkers 1500
MaxConnectionsPercild 10000

我还尝试增加服务器上的
MaxRequestWorkers
,但没有看到任何效果。当我从命令行运行“httpd”时,我意识到发生了什么,它给了我以下警告:

AH00180: WARNING: MaxRequestWorkers of 512 exceeds ServerLimit value of
 256 servers, decreasing MaxRequestWorkers to 256.
 To increase, please see the ServerLimit directive.

在您的配置中,
ServerLimit
仍然是256,因此
MaxRequestWorkers
也被这个值限制。

在我的情况下,我找不到任何解决方案,所以我将把这个答案留在这里,以帮助其他有这个问题的人。在我们的例子中,增加MaxRequestWorkers没有帮助

我们有一台服务器,至少一年来一直运行良好。突然,它开始出现连接https的问题。在apache错误日志中,我们发现了一个“服务器到达MaxRequestWorkers”错误,但是流量非常慢(30-40个访客处于活动状态)

在深入查看日志和一些研究之后,我发现这个问题是一个问题


这种攻击很容易缓解。您可以看看。

在我的情况下,在低响应速度之后,首先我将
MaxRequestWorkers
从150增加到500。但是apache
error.log
中有一个警告,我意识到我也应该增加
ServerLimit
,因为它的默认值是256。此外,我在
mpm_prefork.conf
中没有找到
ServerLimit 256
,因此我在其中添加了
ServerLimit 512
作为一个新行,问题得到了解决。

我将MaxRequestWorkers增加到5000,服务器现在已经稳定了24小时以上。最近几周最长的一次,无需重新启动apache。流量已增至每天约200万次,我们也遇到了同样的问题。StartServers 1024分钟PareThreads 1024 MaxSpareThreads 1024 MaxClients 1024 ServerLimit 1024 ThreadLimit 1024 ThreadsPerChild 1024 MaxRequestWorkers 8192 MaxConnectionsPerChild 0 MaxRequestPerChild 4096在不添加更多服务器的情况下,您还能做些什么吗?Stack Overflow是一个关于编程和开发问题的网站。这个问题似乎离题了,因为它与编程或开发无关。请参见帮助中心中的。也许或者会是一个更好的提问的地方。也看到我很高兴它似乎解决了你,但当你说“我把新的设置在该文件”,你指的是哪个设置?什么是旧值,什么是新值?向下投票:此回答对任何其他人都没有用处-您不包括您实际做出的更改,也不提供任何关于其他人如何解决此问题的指示。请使用您替换的配置/键值对的有用信息/片段进行更新/etc.@MattRabe Downvoting为什么?提供的答案完全可以理解,除非您不熟悉Apache或。。。Linux目录/文件。@LucianoFantuzzi OP选择自己的答案是正确的,尽管没有包括所有相关信息。“新环境”。。。我们可以从页面的其余部分推断出键和值,但是这个答案本身仍然缺乏完整性。如果OP会做一些小的编辑来包含key&value,那么我完全赞成!
$ 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)
AH00180: WARNING: MaxRequestWorkers of 512 exceeds ServerLimit value of
 256 servers, decreasing MaxRequestWorkers to 256.
 To increase, please see the ServerLimit directive.