Choose an Apache MPM: event, worker, or prefork

Choose event for a compatible threaded Apache deployment, retain prefork for modules that require it, and size concurrency against measured resource use.

Best practices
Illustration of a Linux server and log data

For a typical Apache 2.4 deployment on a supported Unix platform, start with event if all loaded modules support a threaded MPM. Keep prefork when an in-process module requires it, such as a conventional non-thread-safe mod_php build. PHP-FPM lets PHP run separately from Apache and works with event.

There is no universal memory or throughput ranking for every workload. The MPM determines connection and worker management; application behavior and backend capacity still determine much of the result.

Compare the execution models

MPM Model Practical consideration
prefork Multiple processes, one request-handling thread per child Supports non-thread-safe modules, but many concurrent requests can require many processes.
worker Several processes with multiple worker threads Shares process resources, though idle keep-alive connections occupy worker threads.
event A threaded model with asynchronous connection handling Frees workers from many idle keep-alive connections; some filters and workloads still require a worker.

Only one MPM can be loaded at a time. Check the running configuration:

apachectl -V | grep MPM
# On installations that use this command name:
httpd -V | grep MPM

Change MPMs deliberately

On Debian or Ubuntu, first migrate PHP sites to an installed and tested PHP-FPM service. Then disable the actual PHP module name reported by your installation before disabling its MPM dependency. For example, only on a machine that uses php8.3:

sudo a2dismod php8.3
sudo a2dismod mpm_prefork
sudo a2enmod mpm_event proxy_fcgi setenvif
sudo a2enconf php8.3-fpm
sudo apachectl configtest
sudo systemctl restart apache2

The versioned module and configuration names must match your packages. Switching off mod_php without configuring PHP-FPM can break PHP handling. Confirm a PHP request is executed correctly before reopening traffic.

RHEL-family packages commonly select the MPM in /etc/httpd/conf.modules.d/00-mpm.conf. Use the distribution's configuration layout and restart procedure. Review MPM-specific <IfModule> blocks as well as third-party modules; ordinary virtual-host routing does not itself need to change.

Size workers using measurements

This is an example, not a production sizing recommendation:

<IfModule mpm_event_module>
    StartServers              3
    MinSpareThreads           25
    MaxSpareThreads           75
    ThreadsPerChild           25
    MaxRequestWorkers         400
    MaxConnectionsPerChild    1000
</IfModule>

With 25 threads per child, 400 request workers require capacity for 16 child processes. ServerLimit, ThreadLimit, and the actual MPM configuration constrain these settings. Event can keep additional asynchronous connections open, so MaxRequestWorkers is not simply a limit on all connected clients.

Compare busy workers, memory, response latency, throughput, errors, and backend waits under the same workload. A change that accepts more requests while overwhelming PHP or the database is not an improvement.

Common decisions

Keep worker if its behavior suits an established deployment and changing it brings no demonstrated benefit. Do not migrate from Apache to Nginx solely on an assumed performance ranking; benchmark the actual static, proxy, and application workload.

When event saturates, identify whether CPU, memory, slow clients, or a backend is responsible. Caching, a CDN, backend tuning, or horizontal scaling may help more than changing worker counts.

References

Get a tailored plan

Contact us

Join the community

Scan with WeChat
to join the community

Try Guance

Start online and pay only for what you use.

Get started

Choose a Guance plan

Code hosting