Apache HTTPD Thread management config and monitoring

Apache HTTPD uses the event MPM (Multi-Processing Module) as the default thread management mode. There is a sample configuration file named httpd-mpm.conf, but it’s important to note that this file is not enabled by default. You can see in httpd.conf that the Include directive for it is commented out:
#Include conf/extra/httpd-mpm.conf.

mpm config not enabled

Therefore, don’t assume that modifying httpd-mpm.conf will improve Apache’s threading performance unless it is explicitly included.

For the config , first we can use

apachectl -V 

to check the MPM is using event mode.

check apache MPM mode

To simplify the MPM configuration, you can simply include the following configuration section in your own configuration file.

<IfModule mpm_event_module>
    StartServers             3
    MinSpareThreads         75
    MaxSpareThreads        250
    ThreadsPerChild         25
    ServerLimit             48
    MaxRequestWorkers      1200
    MaxConnectionsPerChild   0
</IfModule>

This configuration increases Apache’s default number of threads from 400 to 1200. In the configuration above, each process is allowed to run up to 25 threads.

Note that ThreadsPerChild multiplied by ServerLimit equals MaxRequestWorkers

ThreadsPerChild * ServerLimit = MaxRequestWorkers

25 * 48 = 1200

You can visit Apache’s server-status page to check the current total number of threads running on the server.

also note that to access this page ,you need config location at apache side, below I did not set any restriction, we can add IP restriction to prevent normal users to access this.

<Location "/server-status">
    SetHandler server-status
</Location>
apache server status page

By adding Processed requests (1), Restarting workers (0), and Idle workers (124), we get 125, which represents the current number of running Apache threads:
1 + 0 + 124 = 125.
From the status page, we can also see that there are 5 processes running, and since each process can run 25 threads, 5 × 25 = 125, which matches the thread count.
Both methods give the same result of 125 threads. Although we configured a higher thread limit, because the server’s traffic is relatively low, not all processes are started — so the total number of threads does not reach the configured 1200.

Leave a Reply