The Apache web server is the most popular web server in the world. This is in part due to its modular design. With Apache 2.0 came the Multi Process Modules, or MPMs. The MPMs change the basic functionality of the web server. They do this by modifying how Apache listens to the network, accepts and handles requests. A lot of this functionality is rather technical and outside of the purview of this article. This article will briefly explain what the various MPMs are and how they work. For more information on the various MPMs, please visit the Apache Documentation.
All versions of Apache 2.0 and greater run some form of MPMs. 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 MPM your server is running. You can determine this from running the following command on the command line.
Running that command will give you output that will look like this:
root@host [~]# httpd -V
Server version: Apache/2.2.14 (Unix)
Server built: Dec 16 2009 23:24:26
Cpanel::Easy::Apache v3.2.0 rev4899
Server's Module Magic Number: 20051115:23
Server loaded: APR 1.3.9, APR-Util 1.3.9
Compiled using: APR 1.3.9, APR-Util 1.3.9
Server MPM: Worker
threaded: yes (fixed thread count)
forked: yes (variable process count)
Server compiled with....
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
In this case, this server is running the Worker MPM. This will obviously be different depending on what MPM your server is actually running.
Changing your MPM on a cPanel server is easy. Just run the EasyApache script and select the MPM you want from the available. The list that is present will be different depending on if you are running Apache 2.0 or Apache 2.2. With the exception of Prefork and Worker, the rest of the MPMs are experimental and should not be used.
If you are uncomfortable running the EasyApache yourself, please contact Heroic Support and we will be more than happy to assist you.
With the Prefork module installed, Apache is a non-threaded, pre-forking web server. This means that in a process list, each Apache process that is running is a child that is either servicing a request or waiting for a request. It is very similar to how Apache 1.3 handles requests.
Prefork is the default MPM, so if no MPM is selected in EasyApache, Prefork will be selected. It’s the best choice if Apache has to use non-thread safe libraries such as mod_php. Also it is ideal if isolation of processes is important.
While Prefork isn’t threaded, Worker is threaded. The Worker MPM turns Apache into a multi-process, multi-threaded web server. With Prefork, each Apache child process was one request, each child process is multiple requests with Worker. Worker can handle more requests with less resources than Prefork does.
That said, Worker is incompatible with non-thread safe libraries. So if you need to run something that isn’t Non-thread safe, then Worker isn’t for you.
The Other MPMs
As said earlier in this article, there are other MPMs than the ones mentioned in this article. There are a number of experimental MPMs such as Event and Leader. Liquid Web recommends against running these MPMs. Since they are experimental, we cannot guarantee that they will work as expected or that we will even be able to fix them. Most of these modules have disclaimers to this extent in the office Apache Documentation.
The addition of the Multi Process Modules to Apache increased its power and flexibility. The MPMs allow users to change the core behavior. This increases what a user can do with Apache without having to install additional software. If you have any questions regarding this or anything else, please give Heroic Support a call.
Liquid Web’s Heroic Support is always available to assist customers with this or any other issue. If you need our assistance please contact us:
Toll Free 1.800.580.4985