Recently the company has a customer reported a problem, that is, after running for a while in the Apache log/var/log/httpd/error_log file has an error message
[Fri 29 15:45:37 2016] [ERROR] Server reached maxclients setting, consider raising the maxclients setting
Check, this is due to the number of concurrent links caused by too many, and then check the Apache documentation, found that you can modify the Apache configuration file
The maxclients parameters in the /etc/httpd/conf/httpd.conf are adjusted.
Before adjusting, first check to see if Apache runs in which mode is prefork or worker, use the "/usr/sbin/httpd-l" command to check, when checked out which mode , you can find the corresponding configuration section in/etc/httpd/conf/httpd.conf to modify it.
# httpd-l
Compiled in modules:
core.c
prefork.c
http_core.c
Modify the parameters to
<ifmodule prefork.c>
startservers 8
minspareservers 5
maxspareservers
Serverlimit 256
maxclients 256
maxrequestsperchild 4000
Amended to
<ifmodule prefork.c>
startservers 8
minspareservers 5
maxspareservers 20
serverlimit 1024
maxclients 1024
maxrequestsperchild
</IfModule>
Then restart the Apache "service httpd restart".
The meaning of the parameters, in the configuration of Apache is described in detail, as follows:
# prefork MPM # Startservers:number of server processes to start # minspareservers:minimum number O F server processes which are kept spare # maxspareservers:maximum number of server processes which are kept spare # S Erverlimit: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 # Startserv Ers:initial number of server processes to start # Maxclients:maximum number of simultaneous client connections # Min Sparethreads: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 the each server process # Maxrequestsperchild : Maximum number of requests a server process serves