httpd high memory due to improperly sized MaxClients
Environment
- Red Hat Enterprise Linux (RHEL) 5
- Red Hat Enterprise Linux 6
- JBoss Enterpise Web Server (EWS)
Issue
- Why does the
httpdprocess take so much memory? - The Apache web server has been configured with an 8G RAM enabled virtual machine using prefork with the following parameters:
<IfModule prefork.c>
StartServers 5
MinSpareServers 4
MaxSpareServers 15
ServerLimit 512
MaxClients 512
MaxRequestsPerChild 4000
</IfModule>
- Without any change of access rate, the memory of the machine in a few minutes is filled with
httpdprocesses, and the kernel kills any newhttpdprocess. The client cannot establish any new user session, so rebooting is required.
Resolution
Calculate MaxClients based on available RAM on the system, and use the resultant value in the worker directive.
Root Cause
- The
MaxClientsvalue was not properly calculated and set up.
Diagnostic Steps
- Provide
sosreport. - For details about MaxClient directive check httpd.apache.org: http://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxclients
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
