By Jeff Trawick on Mar 25, 2009
Hello from Amsterdam! We httpd and APR developers have been busy.
On the APR side, for future APR 2.0, the separate APR-Util package is no more (its features were folded into APR proper) and APR pools now use malloc (similar to old pool debug mode). The use of malloc can result in better performance with modern heap libraries (this needs analysis!), and watchmalloc/libumem/ElectricFence/etc. can be used with APR apps much more effectively. (Joe quickly found a longstanding bug in one of the sample apps by linking with ElectricFence.)
An httpd change of great interest to me is the ability to load MPMs as DSOs via the LoadModule directive.
Traditionally you select an MPM on Unix with a configure-time option such as --with-mpm=prefork, --with-mpm=worker, etc. If you want to have multiple MPMs available you build the complete server for every MPM and switch out httpd executable files to change that. You can still do that, but now you can also specify --with-mpm=shared on the configure invocation, build the MPMs you want (via apxs right now :( ), and load the desired MPM with LoadModule.
Here is a sample apxs invocation to build the "Simple" MPM. prefork, worker, and event are similar:
$ cd server/mpm/simple
$ ~/inst/23/bin/apxs -ci -o mod_mpm_simple.la -n mpm_simple_module \\
simple_api.c simple_children.c simple_core.c simple_event.c \\
Now add something like this to httpd.conf:
loadmodule mpm_worker_module modules/mod_mpm_worker.so
loadmodule mpm_event_module modules/mod_mpm_event.so
loadmodule mpm_simple_module modules/mod_mpm_simple.so
loadmodule mpm_prefork_module modules/mod_mpm_prefork.so
$ apachectl -k start -DEVENT (or -DWORKER or -DSIMPLE)
It defaults to prefork if you omit the -Dmpmname parameter.