Httpd – Apache MPM event in Apache 2.4+

apache-2.4httpdperformance

For years I have been using the mpm-prefork module as it was my understanding that this was the preferred worker for Apache 2 and 1.3.

Now I will be installing some fresh Apache servers and will be using the newer 2.4 version, with which the event based mpm which uses epoll/kqueue.

I know in the last few years event based systems have become all the rage (e.g. nginx, lighttpd, node.js), so since mpm-event is now stable in Apache, is this the preferred multi-processing module to use?

I also took note of the comment from the mpm-event documentation page:

The improved connection handling does not yet work for certain
connection filters, in particular SSL. For SSL connections, this MPM
will fall back to the behaviour of the worker MPM and reserve one
worker thread per connection.

Our main site forces an SSL connection, so it is clear that we will not benefit from the improved connection handling related to keep-alive, but is my understanding correct that there will still be some performance improvement since there will be less threading taking place?

Best Answer

The prefork MPM has not been the "preferred" MPM for many years.

The reason it is still the default for many distros is that some third-party libraries have trouble with the threading in the worker MPM (which has been the preferred MPM since version 2.2).

Not modules like mod_php, which is quite thread-safe, but libraries used by modules like mod_php, such as mysqli etc.

In 2.4, we have now switched to the STABLE event MPM.

The release is still very new and the documentation has not been completely updated to reflect this.

As has been the case for years, if the prefork MPM is causing you grief, switch to threaded serving and run your dynamic content via fastCGI.