httpd high memory due to improperly sized MaxClients

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL) 5
  • Red Hat Enterprise Linux 6
  • JBoss Enterpise Web Server (EWS)

Issue

  • Why does the httpd process 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 httpd processes, and the kernel kills any new httpd process. 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 MaxClients value was not properly calculated and set up.

Diagnostic Steps

  1. Provide sosreport.
  2. 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.

Comments