Wandering Thoughts archives


We're finally fully moving away from Apache's prefork MPM (hopefully)

In the very beginning, what is now Apache's prefork MPM was your only option; it was just how Apache worked. Then a long time ago, Apache added other Multi-Processing Modules (MPMs), although they were somewhat untrusted so for a while the conservative, backward compatible default was the prefork MPM. We started using Ubuntu based web servers (running Apache) a long time ago, and so we got their default of the prefork MPM.

At some point, I believe in Ubuntu 18.04, the Ubuntu default MPM changed to the event MPM. Under the normal course of events, that would have been that for our use of the prefork MPM; as we upgraded web servers to 18.04, we'd have gone with the default and so switched from prefork to mpm. This is indeed what happened with most of our web servers. Unfortunately, our primary public web server ran into mysterious problems that caused it to start denying connections, possibly related to this Apache bug. Rather than take our chances on Ubuntu ever fixing whatever the problem was, we switched (back) to the prefork MPM on this server.

It's now late 2022 and all our 18.04 machines are on the way out, including this web server. When we upgrade it to 22.04, we're certainly going to try using the event MPM again, and I hope that it will be fine now. All our other 22.04 web servers are using the event MPM and are fine, but a certain number of them were fine with the event MPM even under 18.04 (now that I look, some other 18.04 servers were using the prefork MPM).

(We pretty much skipped Ubuntu 20.04, including for all of the web servers.)

You might think that the choice of an Apache MPM is a relatively unimportant thing for most people. Unfortunately there are two reasons we really want to switch over to the event MPM. First, we periodically get a flood of people on comparatively slow connections trying to download large datasets from us (often ones related to machine learning). The prefork MPM doesn't cope very well with this (to the point where we were forced to resort to mod_qos with relatively low limits), while the event MPM Is apparently much better and would let us allow tons of people to sit there slowly getting their reference datasets.

Second, an increasing number of other Apache things just don't like the prefork MPM. For example, the last time I looked, the Apache 2.4 HTTP/2 support didn't work under prefork (and in fact logged a verbose message about it). The mod_qos module itself would prefer a different MPM, although it still works for us under prefork. And in general it feels like prefork is basically deprecated; the longer we have to stick with it, probably the worse off we'll be. In Ubuntu, there's also a higher chance that we'll encounter bugs with the prefork MPM since it's not the normal Ubuntu Apache configuration and thus likely gets much less testing.

(Normal people installing Apache on Ubuntu don't have to worry about this because they normally use the defaults. Canonical (and Debian, and Apache) generally makes sure that they work, which these days means making sure that the event MPM pretty much works.)

web/ApachePreforkHopefullyNoMore written at 23:21:23; Add Comment

Page tools: See As Normal.
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.