Apache eats empty memory, frequent downtime

Source: Internet
Author: User
Tags apache error log

The company has a relatively old server, apache/2.0.59 (Unix) php/5.1.2

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:

[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:

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.


Website Source Download

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.