Apache MPMs Prefork vs Worker vs Event


Simple tip for anybody still running Apache serversswitch to MPM Event!
What is MPM Event and how does it improve your server performance without any drawbacks?

  • I switched to MPM Event, I loved it. And you should do it too!

Well cover some minor basics of MPMs and why MPM Event is the best.
Apache 2 introduced multi-processing modules (aka MPMs) that change the way servers processed incoming requests. This was probably a natural evolution to optimize for multi-core CPUs used in server environments. The idea was to write these modules to use the multi-cores more effectively, processing more requests without issues.
As a quick FYI: most of you will not have access to change this unless youre on a VPS and/or have root access to server.

Apache MPMs Prefork vs Worker vs Event

By default, Apache servers typically have 3 threads available:

Prefork


  • Implements a non-threaded, pre-forking web server.
  • The default one, most stable and also compatible with older software. Unfortunately, also the slowest.
  • Im guessing its called that because its the original version before they forked off into the other versions.
  • You will almost always find this one installed by default as many companies are too lazy to reconfigure hundreds of their servers. Theres also a shady skepticism that they dont want your server to perform that well since they want to upsell you to a bigger server sooner.



Worker


  • Multi-Processing Module implementing a hybrid multi-threaded multi-process web server.
  • Faster than prefork and can handle more visitors.



Event


  • A variant of the worker MPM with the goal of consuming threads only for connections with active processing.
  • The fastest MPM and considered least stablealthough fine for most people in real-world practices.
  • Uses the least resources and can handle the most visits.



Whats the verdict?

Go with MPM Event first. You can switch over to it easy. A few command line entries or also a simple switch in EasyApache if you have WHM/cPanel (show in the image above).

If you have problems, then try Worker and that last is Prefork. Some people noticed faster performance with Prefork or Worker. It can depend on the type of website you have, CPU, ram use, etc. But generally with a high performance server looking to serve many visitors fast, I always recommend MPM Event.

Other reading for you:



:
Prefork
mod_mpm_itk


:
https://wpjohnny.com/apache-performa...-to-mpm-event/