Apache performance tip – switch to MPM Event!

Simple tip for anybody still running Apache servers…switch 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!

We’ll cover some minor basics of MPM’s and why MPM Event is the best.

Apache 2 introduced multi-processing modules (aka MPM’s) that change the way servers processed incoming requests. This was probably a natural evolution to optimize for multi-core CPU’s 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 you’re 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.
  • I’m guessing it’s called that because it’s 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. There’s also a shady skepticism that they don’t 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 stable…although fine for most people in real-world practices.
  • Uses the least resources and can handle the most visits.

What’s 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:

Leave a Reply

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