Multi-Processing Modules: MPMs


Last modified: July 11, 2022

Overview

An Apache Multi-Processing Module (MPM) provides a modular approach to web server functions. The MPM that you select determines how Apache binds to network ports, accepts HTTP requests, and dispatches child processes to handle the HTTP requests.

  • MPMs allow the user to choose which features, characteristics, or modules they want to include with a server request. The modules then load these requests at compile or run time.
  • Due to the differences between each MPM, some MPMs work better on specific systems than others. For example, we recommend that you use the prefork MPM if you use older software that requires stability and compatibility. For websites that require more diversity and scalability, we recommend that you use the worker or event MPMs.

EasyApache 4 installs the prefork MPM by default. You can only install one MPM on your system at a time.

Available MPMs

EasyApache 4 provides the following MPMs:

worker

The worker MPM causes Apache to fork into several processes so that a single crash does not kill the entire Apache process. Each forked process creates numerous threads, and a listener thread that listens for connections. This enables the system to serve multiple requests concurrently. For more information, read the Apache MPM worker documentation.

event

The event MPM serves a single HTTP request across multiple threads. However, the event MPM uses a dedication system and dedicates a thread to handle all live connections. The system allocates a request to the child threads only when it receives a request. This allows the threads instant availability after the request finishes.

We recommend this MPM for users that only make occasional concurrent requests, or when a user requires a long keep-alive timeout. For more information, read the Apache MPM event documentation.

prefork

The prefork MPM causes Apache to fork into additional processes before the system receives requests. When the server receives requests, it responds quickly to each request because an Apache process already exists to handle it. If a problem occurs with an individual process, the system can kill the process with no effect on the other Apache processes.

Because the prefork MPM is not threaded, each child process can only handle one request at a time. The system queues concurrent requests and the MPM waits to process each request until the system becomes available. These scaled child processes may use of a large amount of system RAM. For more information, read the Apache MPM prefork documentation.

Important:
Only use the prefork MPM for non-thread-safe modules.

Note:
You may also use the MPM ITK module.

Guidelines to select an MPM

Remember:
  • If you do not select an MPM option, EasyApache installs the prefork MPM by default.
  • EasyApache 4 only builds one MPM into your Apache configuration.
  • The MPM ITK module is not an MPM. You must use the prefork MPM in order to use the MPM ITK Apache module. For more information, read the The MPM ITK module section.
  • cPanel & WHM only supports systems that offer threads and safe-thread polling.

Because each system possesses different requirements, use the following information to determine the proper MPM for your system.

  • If your system requires threads and allows for safe thread-polling, use the event MPM.
  • If your system requires threads, but does not allow for safe thread-polling, use the worker MPM.
  • If your system does not require threads and does not allow for safe thread-polling, use the prefork MPM.

The MPM ITK module

The mod_mpm_itk module now exists only as an Apache module. It does not function as a stand-alone MPM. You can install this module with WHM’s EasyApache 4 interface (WHM » Home » Software » EasyApache 4) or via yum. For more information, read our Apache Module: MPM ITK documentation.

Warning:
  • Only systems that run Apache 2.4 can install the MPM ITK Apache module.
  • You must install the prefork MPM in order to use the MPM ITK module.

Change your Apache MPM

In the interface

We strongly recommend that you change your Apache MPM in the Apache MPM section of WHM’s EasyApache 4 interface (WHM » Home » Software » EasyApache 4). This method ensures that the system implements your changes correctly.

On the command line

To change your system’s MPM on the command line in EasyApache 4, use the yum shell command. The yum shell command issues several commands in a single transaction.

Warning:
  • If you remove an MPM via the command line but do not use the yum shell command, the system will uninstall the ea-apache24 package.
  • Do not remove the Apache stack completely.

How to replace the worker MPM with the event MPM

To replace the worker MPM with the event MPM, run the following commands:

1
2
3
4
yum shell
remove ea-apache24-mod_mpm_worker
install ea-apache24-mod_mpm_event
run

How to replace the worker MPM with the prefork MPM

To replace the worker MPM with the prefork MPM, run the following commands:

1
2
3
4
5
6
yum shell
remove ea-apache24-mod_mpm_worker
remove ea-apache24-mod_cgid
install ea-apache24-mod_mpm_prefork
install ea-apache24-mod_cgi
run

How to replace the event MPM with the prefork MPM

To replace the event MPM with the prefork MPM, run the following commands:

1
2
3
4
5
6
yum shell
remove ea-apache24-mod_mpm_event
remove ea-apache24-mod_cgid
install ea-apache24-mod_mpm_prefork
install ea-apache24-mod_cgi
run

Additional Documentation