Comparison of Apache Multi-Processing Modules

A quick summary of the major Linux/Unix Apache multi-processing modules.

Prefork

  • Default MPM in Apache < 2.4
  • Consumes more RAM than threaded MPMs like Worker or Event 
  • Threadless design is safe for non-thread-safe modules like mod_php
  • Spawns child processes that each deal with one request at a time
  • Performs poorly on high-traffic servers with many concurrent requests, since requests have to wait until processes are free

Worker

  • Threaded design is lighter on RAM and better for busy servers
  • Spawns processes with many threads each, and each thread handles one connection at a time
  • Unsafe for use with non-thread-safe modules, so alternatives should be found (e.g., FastCGI and PHP-FPM instead of mod_php)
  • Best choice in most environments running < Apache 2.4

Event

  • Considered stable as of Apache 2.4, and default in most installs of Apache >= 2.4
  • Similar to worker in threaded design; lighter RAM usage than prefork; good for busy servers
  • Unsafe for use with non-thread-safe modules, so alternatives should be found (e.g., FastCGI and PHP-FPM instead of mod_php)
  • One major performance advantage over worker: passes all kept-alive connections to a single thread, so idle/kept-alive connections aren’t consuming many threads and their needed memory. SSL connections are treated identically to worker.

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *