Hello from ApacheCon Europe 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 \\

simple_io.c simple_run.c

Now add something like this to httpd.conf:

<IfDefine WORKER>

loadmodule mpm_worker_module modules/mod_mpm_worker.so

</IfDefine>

<IfDefine EVENT>

loadmodule mpm_event_module modules/mod_mpm_event.so

</IfDefine>

<IfDefine SIMPLE>

loadmodule mpm_simple_module modules/mod_mpm_simple.so

</IfDefine>

<IfDefine !WORKER>

<IfDefine !EVENT>

<IfDefine !SIMPLE>

<IfModule !prefork.c>

loadmodule mpm_prefork_module modules/mod_mpm_prefork.so

</IfModule>

</IfDefine>

</IfDefine>

</IfDefine>

 

Start with

$ apachectl -k start -DEVENT (or -DWORKER or -DSIMPLE)

It defaults to prefork if you omit the -Dmpmname parameter.

 

Comments:

Finally! Being able to choose the mpm at runtime rather than buildtime is a great leap forward. Especially packagers of httpd must be happy.

Posted by Mads on March 26, 2009 at 05:21 PM PDT #

Yeah! I hope this results in more experimentation with MPMs other than prefork, and I look forward to seeing what the downstream packagers do with this capability.

In the meantime there's a bit more work to review/refine the API changes, create a proper build mechanism for DSO MPMs (e.g., to be able to build Apache with DSO MPMs and end up with a DSO for each MPM that runs on your system), document the capability, etc. Minor details ;)

Posted by Jeff on March 26, 2009 at 05:31 PM PDT #

Post a Comment:
Comments are closed for this entry.
About

Jeff Trawick

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today