Apache Prefork versus Worker


The prefork MPM uses multiple child processes with one thread each. Each process handles one connection at a time. On many systems, prefork is comparable in speed to worker, but uses more memory. Prefork’s threadless design has advantages over worker in some situations: it can be used with non-thread-safe third-party modules, and it is easier to debug on platforms with poor thread debugging support.


  • Developed in Apache 1
  • Multiple child processes, 1 thread per child process, child processes handle requests
  • Better isolation and stability
  • Tested to work correctly with Parallels Plesk


  • Has higher memory consumption and lower performance over the threaded MPMs


The worker MPM uses multiple child processes with many threads each. Each thread handles one connection at a time. Worker is generally a good choice for high-traffic servers because it has a smaller memory footprint than the prefork MPM.


  • Developed in Apache 2 in addition to prefork module
  • Multiple processes, many threads per process, threads handle requests
  • Uses less memory and provides higher performance


  • Does not provide the same level of isolation request-to-request as a process-based MPM does
  • If single thread is suspended/out of control, the entire process will be terminated, affecting all of the threads
  • Requires a thread-safe processor to handle dynamic content
  • Not supported by Parallels PleskEach module has a different set of the configuration directives in the Apache webserver configuration file:


<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   20
ServerLimit      256
MaxClients       256
MaxRequestsPerChild 4000


<IfModule worker.c>
 StartServers         2
 MaxClients         150
 MinSpareThreads     25
 MaxSpareThreads     75
 ThreadsPerChild     25
 MaxRequestsPerChild  0


In the RedHat-based Linux distributions, Apache webserver is configured to run with the prefork module by default. Technically, you could switch it to “worker” if you decide that this would suit your needs better, however keep in mind the warning below.

Warning: Parallels Plesk Panel was not tested with Apache MPM worker and installing it on Debian/Ubuntu will lead to removal of psa package.

If you still wish to switch to worker module, it is sufficient to uncomment this directive in /etc/sysconfig/httpd file:

# grep HTTPD= /etc/sysconfig/httpd

and restart Apache:

# /etc/init.d/httpd restart

Note, that the worker MPM assumes a special PHP module to be configured/loaded by the Apache webserver:

# cat /etc/httpd/conf.d/php.conf|grep -A3 "worker.c"
<IfModule worker.c>
 LoadModule php5_module modules/libphp5-zts.so

In the end, the question that is frequently asked by customers and engineers is: how do I determine which MPM module the server is running on?

First, use ps utility to determine the command line of running Apache process:

 # ps aux | grep -v grep | egrep "apache|httpd"
 root      1684  0.0  1.4 284484 14888 ?        Ss   17:52   0:00 /usr/sbin/httpd
 apache    3101  0.0  0.7 284484  7596 ?        S    18:02   0:00 /usr/sbin/httpd 

and check which module it is running by using this command:

 # /usr/sbin/httpd -l | egrep "prefork|worker" 

Alternatively, check /etc/sysconfig/httpd configuration file:

 # grep -B 5 HTTPD= /etc/sysconfig/httpd
 # The default processing model (MPM) is the process-based
 # "prefork" model. A thread-based model, "worker," is also
 # available, but does not work with some modules (such as PHP).
 # The service must be stopped before changing this variable.

Leave a Reply

Your email address will not be published.

Enter Captcha Here : *

Reload Image