<
description>A variant of the <
module>worker</
module> MPM with the goal
of consuming threads only for connections with active processing</
description>
<
identifier>mpm_event_module</
identifier>
<
p>The <
module>event</
module> Multi-Processing Module (MPM) is
designed to allow more requests to be served simultaneously by
passing off some processing work to supporting threads, freeing up
the main threads to work on new requests. It is based on the
<
module>worker</
module> MPM, which implements a hybrid
multi-process multi-threaded server. Run-time configuration
directives are identical to those provided by
<
module>worker</
module>.</
p>
<
p>To use the <
module>event</
module> MPM, add
<
code>--with-mpm=event</
code> to the <
program>configure</
program>
script's arguments when building the <
program>httpd</
program>.</
p>
<
seealso><
a href="worker.html">The worker MPM</
a></
seealso>
<
section id="how-it-works"><
title>How it Works</
title>
<
p>This MPM tries to fix the 'keep alive problem' in HTTP. After a client
completes the first request, the client can keep the connection
open, and send further requests using the same socket. This can
save signifigant overhead in creating TCP connections. However,
Apache HTTP Server traditionally keeps an entire child
process/
thread waiting
for data from the client, which brings its own disadvantages. To
solve this problem, this MPM uses a dedicated thread to handle both
the Listening sockets, and all sockets that are in a Keep Alive
<
p>The MPM assumes that the underlying <
code>apr_pollset</
code>
implementation is reasonably threadsafe. This enables the MPM to
avoid excessive high level locking, or having to wake up the listener
thread in order to send it a keep-alive socket. This is currently
only compatible with KQueue and EPoll.</
p>
<
section id="requirements"><
title>Requirements</
title>
<
p>This MPM depends on <
glossary>APR</
glossary>'s atomic
compare-and-swap operations for thread synchronization. If you are
compiling for an x86 target and you don't need to support 386s, or
you are compiling for a SPARC and you don't need to run on
pre-UltraSPARC chips, add
<
code>--enable-nonportable-atomics=yes</
code> to the
<
program>configure</
program> script's arguments. This will cause
APR to implement atomic operations using efficient opcodes not
available in older CPUs.</
p>
<
p>This MPM does not perform well on older platforms which lack good
threading, but the requirement for EPoll or KQueue makes this
<
li>To use this MPM on FreeBSD, FreeBSD 5.3 or higher is recommended.
However, it is possible to run this MPM on FreeBSD 5.2.1, if you
use <
code>libkse</
code> (see <
code>man
libmap.conf</
code>).</
li>
<
li>For NetBSD, at least version 2.0 is recommended.</
li>
<
li>For Linux, a 2.6 kernel is recommended. It is also necessary to
ensure that your version of <
code>glibc</
code> has been compiled
with support for EPoll.</
li>
<
directivesynopsis location="mpm_common"><
name>CoreDumpDirectory</
name>
<
directivesynopsis location="mpm_common"><
name>EnableExceptionHook</
name>
<
directivesynopsis location="mpm_common"><
name>Group</
name>
<
directivesynopsis location="mpm_common"><
name>Listen</
name>
<
directivesynopsis location="mpm_common"><
name>ListenBacklog</
name>
<
directivesynopsis location="mpm_common"><
name>SendBufferSize</
name>
<
directivesynopsis location="mpm_common"><
name>MaxClients</
name>
<
directivesynopsis location="mpm_common"><
name>MaxMemFree</
name>
<
directivesynopsis location="mpm_common"><
name>MaxConnectionsPerChild</
name>
<
directivesynopsis location="mpm_common"><
name>MaxSpareThreads</
name>
<
directivesynopsis location="mpm_common"><
name>MinSpareThreads</
name>
<
directivesynopsis location="mpm_common"><
name>PidFile</
name>
<
directivesynopsis location="mpm_common"><
name>ScoreBoardFile</
name>
<
directivesynopsis location="mpm_common"><
name>ServerLimit</
name>
<
directivesynopsis location="mpm_common"><
name>StartServers</
name>
<
directivesynopsis location="mpm_common"><
name>ThreadLimit</
name>
<
directivesynopsis location="mpm_common"><
name>ThreadsPerChild</
name>
<
directivesynopsis location="mpm_common"><
name>ThreadStackSize</
name>
<
directivesynopsis location="mpm_common"><
name>User</
name>