Apache [error] server reached MaxClients setting, consider raising the MaxClients setting

最近公司有个客户报了一个问题,就是运行一段时间后在apache的日志/var/log/httpd/error_log文件中有一条错误信息

[Fri Jul 29 15:45:37 2016] [error] server reached MaxClients setting, consider raising the MaxClients setting

检查了一下,这是由于并发链接数太多导致的,后来查了一下apache的文档,发现可以通过修改apache的配置文件

/etc/httpd/conf/httpd.conf中的MaxClients参数来调整。

在调整之前首先要检查一下apache运行在哪一种模式下是prefork还是worker,使用“/usr/sbin/httpd -l”命令来检查,当检查出是哪一种模式之后,就可以找到/etc/httpd/conf/httpd.conf中对应的配置部分来修改。

# httpd -l
Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c

修改一下参数,将其中

<IfModule prefork.c>  
StartServers       8  
MinSpareServers    5  
MaxSpareServers   20  
ServerLimit      256  
MaxClients       256  
MaxRequestsPerChild  4000  
</IfModule> 

修改为

<IfModule prefork.c>  
StartServers     8  
MinSpareServers  5  
MaxSpareServers  20  
ServerLimit     1024  
MaxClients      1024  
MaxRequestsPerChild  50  
</IfModule>

然后重新启动apache “service httpd restart”。

关于参数的意义,在apache的配置中有详细说明,如下:

# 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  
# ServerLimit: maximum value for MaxClients for the lifetime of the server  
# MaxClients: maximum number of server processes allowed to start  
# MaxRequestsPerChild: maximum number of requests a server process serves  
# worker MPM  
# StartServers: initial number of server processes to start  
# MaxClients: maximum number of simultaneous client connections  
# MinSpareThreads: minimum number of worker threads which are kept spare  
# MaxSpareThreads: maximum number of worker threads which are kept spare  
# ThreadsPerChild: constant number of worker threads in each server process  
# MaxRequestsPerChild: maximum number of requests a server process serves  
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值