What are Apache Web Server's Multi-Processing Modules(MPMs) and their fine tuning parameters ?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (All Versions)
  • Apache Web Server, httpd package.
  • Red Hat JBoss Enterprise Web Server (EWS)
  • Red Hat JBoss Web Server (JWS)

Issue

  • What are the types of Apache Web Server's Multi-Processing Modules (MPMs) ?
  • Wha are the the different parameters that these modules contains for fine tuning apache?
  • What are prefork.c and worker.c modules inside httpd.conf ?
  • What are the tuning parameters for Apache HTTP Server?
  • MPM module configuration.
  • We are planning to install JWS 3.0 webserver and I have used redhat tool for suggested parameter for worker MPM from the URL https://access.redhat.com/labs/lbconfig/ The question here is, the box is sharing 20 to 30 JWS 3.0 instances. In that case are the suggested parameteres below still valid ?
    E.g For a 2 core CPU, I got the MPM module configuration as below:
<IfModule mpm_worker_module>
    ThreadLimit         60
    ServerLimit         10
    StartServers        3
    MinSpareThreads     5
    MaxSpareThreads     20
    MaxClients          600
    ThreadsPerChild     60
    MaxRequestsPerChild 0
</IfModule>

Can I use the same configuration for another 20 JWS 3.0 instances on the same box?

Resolution

  • The Apache Web Server comes with a Multi-Processing Modules (MPMs) mainly 'prefork' MPM and 'worker' MPM which are responsible for binding to network ports on the machine, accepting requests, and dispatching children to handle the requests.
    These modules are present in the Apache configuration file under directive,
<IfModule prefork.c>
  <configuration_parameters> 
</IfModule prefork.c> 

<IfModule worker.c>
  <configuration_parameters>
</IfModule worker.c>

-- The worker MPM uses 'multiple child processes with many threads each'. Each thread handles one connection at a time. Worker generally is a good choice for websites wit high-traffic / load because it has a smaller memory footprint than the prefork MPM.

-- The prefork MPM uses 'multiple child processes with one thread each'. Each process handles one connection at a time. On many systems, prefork is comparable in speed to worker, but it uses more memory.

  • Both the modules contains parameter like the following:

StartServers: number of server processes to start

MinSpareServers: minimum number of server processes which are kept spare

MaxSpareServers: maximum number of server processes which are kept spare

ServerLimit: maximum value for MaxClients for the lifetime of the server

MaxClients: maximum number of server processes allowed to start

  • The MaxClients is optimal at 200 * the count of CPU cores for the prefork mpm and 300 * the count of CPU cores for the worker mpm.

MaxRequestsPerChild: maximum number of requests a server process serves

Please refer the below link to understand the detail meaning of each of the above parameter.
- RHEL5 deployment guide
- RHEL6 deployment guide

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.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.