Apache MPMs Explained

  • November 14, 2016
  • 0 Comments

All versions of Apache 2.0 and greater run some form of MPM, and there are a variety of MPMs for the various operating systems. This article will only be focusing on those available for the Linux operating system. First you’ll want to determine what version of Apache and which MPM your server currently is running. You can determine this by running the following command on the command line.

httpd -V | grep -i 'version\|mpm'

Running that command will give you output that will look like this:

[root@host]# httpd -V | grep -i 'version\|mpm'
Server version: Apache/2.4.16 (Unix)
Server MPM: event

In this case, the server is running Apache 2.4 and using the Event MPM. This output may be different depending on the Apache version and MPM your server currently is running.

Changing your MPM on a cPanel server is easy. Just run the EasyApache script and select the MPM you want from those available. The list that is present will be different depending on whether you are running Apache 2.0, Apache 2.2, or Apache 2.4. On Apache versions below 2.4, only Prefork and Worker are considered stable. The Event MPM is considered experimental on Apache 2.2 and should only be used with Apache 2.4 or later.

If you are uncomfortable running the EasyApache yourself, please contact Heroic Support® and we will be more than happy to assist you.

Prefork

With the Prefork module installed, Apache is a non-threaded, pre-forking web server. That means that each Apache child process contains a single thread and handles one request at a time. Because of that, it consumes more resources than the threaded MPMs: Worker and Event.

Prefork is the default MPM, so if no MPM is selected in EasyApache, Prefork will be selected. It still is the best choice if Apache has to use non-thread safe libraries such as mod_php (DSO), and is ideal if isolation of processes is important.

Worker

The Worker MPM turns Apache into a multi-process, multi-threaded web server. Unlike Prefork, each child process under Worker can have multiple threads. As such, Worker can handle more requests with fewer resources than Prefork. Worker generally is recommended for high-traffic servers running Apache versions prior to 2.4. However, Worker is incompatible with non-thread safe libraries. If you need to run something that isn’t thread safe, you will need to stick with Prefork.

Event

Each process under Event also can contain multiple threads but, unlike Worker, each is capable of more than one task. Apache has the lowest resource requirements when used with the Event MPM.

Event, though, is supported only on servers running Apache 2.4. Under Apache 2.2, Event is considered experimental and is incompatible with some modules on older versions of Apache. Nevertheless, on high-traffic Apache 2.2 servers where Apache has experienced issues with memory, upgrading Apache to take advantage of the Event MPM can yield significant results.

taken from: https://www.liquidweb.com/kb/apache-mpms-explained/

How helpful was this article to you?

Posting has been disabled.