In the deployment of a set of intranet test environment, frequent downtime, after the boot constantly eat memory, restart Apache memory consumption will continue to rise until swap run out, until the crash, due to the intranet environment, server concurrency and pressure are very small.
Check the Apache error log for a large number of similar errors:
Copy Code code as follows:
[Tue Feb 14 14:49:28 2012] [Warn] child process 7751 still did not exit, sending a sigterm
[Tue Feb 14 14:49:30 2012] [ERROR] Child process 7603 still did not exit, sending a SIGKILL
[Tue Feb 14 14:49:30 2012] [ERROR] Child process 7614 still did not exit, sending a SIGKILL
It is because some script in PHP has a memory leak code snippet. The number of processing requests for the process that Apache handles these snippets is set to infinity. That is, these processes will only be killed if the Apache reboot (Stop-start mode) or the server reboots, or it will run until the last bit of the system's resources (primarily memory) are exhausted.
Problem Analysis:
Copy Code code as follows:
Maximum number of processes that the server allows to configure
Serverlimit 1500
Sets the number of child processes that are established when the server starts. Because the number of subprocess depends on the weight of the load dynamically, it is not generally necessary to adjust this parameter.
Startservers 5
Minspareservers: Sets the minimum number of idle child processes. An idle subprocess is a child process that is not processing a request. If the current number of idle child processes is less than minspareservers, Apache will produce a new subprocess at a maximum rate of one per second.
Minspareservers 5
Sets the maximum number of idle child processes. If there is currently an idle subprocess exceeding the maxspareservers number, the parent process kills the extra child processes.
Maxspareservers 10
The maximum number of Access requests (maximum number of threads) that are used for client requests.
MaxClients 1500
Set the maximum number of requests that each child process is allowed to provide during its lifetime
Maxrequestsperchild 50
Problem solving:
Set Maxrequestsperchild 50 or 30
Maxrequestsperchild can not be too large, and can not be set to 0, preferably set to a relatively small number, 100 may be enough to prevent the httpd process has an unexpected memory leak.