Switching Apache to the event multi-processing module (MPM) improves concurrency and responsiveness on busy hosts, especially with long-lived KeepAlive connections and HTTP/2 traffic. The event MPM prevents idle keep-alive connections from consuming worker capacity, which can lower latency and reduce wasted memory under load.

An MPM is the core Apache module that decides how connections map onto processes and threads. On Ubuntu and Debian, the active MPM is controlled by enabling exactly one of mpm_event, mpm_worker, or mpm_prefork via symlinks in /etc/apache2/mods-enabled, typically managed with a2enmod and a2dismod.

Only one MPM can be loaded at a time, and changing it requires restarting the apache2 service. The event (and worker) MPM is threaded, so modules that require a non-threaded model—most notably embedded mod_php from libapache2-mod-php—must be removed or replaced with a process-based runtime such as PHP-FPM; otherwise the server may refuse to start or revert to prefork behavior.

Steps to enable the event MPM in Apache:

  1. Open a terminal with sudo privileges.
    $ whoami
    user
  2. Confirm which Apache MPM is currently active.
    $ apache2ctl -V | grep -i mpm
    Server MPM:     prefork
  3. Check for an embedded PHP module before switching to a threaded MPM.
    $ apache2ctl -M | grep -E 'php[0-9]+_module|php_module'
     php_module (shared)

    No output indicates mod_php is not loaded.

    A matching php*_module line typically indicates libapache2-mod-php is active and requires mpm_prefork; enable mpm_event only after moving PHP to PHP-FPM (or equivalent) to avoid startup failures.

  4. Disable the embedded PHP module if it is loaded (example shown for PHP 8.3).
    $ sudo a2dismod php8.3
    Module php8.3 disabled.
    To activate the new configuration, you need to run:
      systemctl restart apache2

    Replace php8.3 with the installed libapache2-mod-php module name on your host.

  5. Disable the prefork MPM module.
    $ sudo a2dismod mpm_prefork
    Module mpm_prefork disabled.
    To activate the new configuration, you need to run:
      systemctl restart apache2
  6. Disable the worker MPM module if it is enabled.
    $ sudo a2dismod mpm_worker
    Module mpm_worker already disabled
  7. Enable the event MPM module.
    $ sudo a2enmod mpm_event
    Considering conflict mpm_worker for mpm_event:
    Considering conflict mpm_prefork for mpm_event:
    Enabling module mpm_event.
    To activate the new configuration, you need to run:
      systemctl restart apache2
  8. Test the Apache configuration for syntax errors.
    $ sudo apache2ctl -t
    Syntax OK
  9. Restart the apache2 service to apply the MPM change.
    $ sudo systemctl restart apache2

    On RHEL-family systems, the service name is typically httpd rather than apache2.

  10. Verify that Apache now reports the event MPM.
    $ apache2ctl -V | grep -i mpm
    Server MPM:     event
  11. Confirm the service is running after the change.
    $ sudo systemctl status apache2
    ● apache2.service - The Apache HTTP Server
         Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: enabled)
         Active: active (running) since Sat 2026-01-10 13:10:29 +08; 326ms ago
           Docs: https://httpd.apache.org/docs/2.4/
    ##### snipped #####