prefork.xml revision 1a9d040bd97b9bacbcb5aead589523bf60572e04
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<?xml version="1.0"?>
efa4f29a7761c2123557276566f45c9084e734c6patrikj<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
e942c741056732f50da2074b36fe59805d370650slive<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<modulesynopsis>
efa4f29a7761c2123557276566f45c9084e734c6patrikj
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>prefork</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<description>Implements a non-threaded, pre-forking web server</description>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<status>MPM</status>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<sourcefile>prefork.c</sourcefile>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<identifier>mpm_prefork_module</identifier>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<summary>
1a9d040bd97b9bacbcb5aead589523bf60572e04slive <p>This Multi-Processing Module (MPM) implements a non-threaded,
1a9d040bd97b9bacbcb5aead589523bf60572e04slive pre-forking web server that handles requests in a manner similar
1a9d040bd97b9bacbcb5aead589523bf60572e04slive to Apache 1.3. It is appropriate for sites that need to avoid
1a9d040bd97b9bacbcb5aead589523bf60572e04slive threading for compatibility with non-thread-safe libraries. It
1a9d040bd97b9bacbcb5aead589523bf60572e04slive is also the best MPM for isolating each request, so that a problem
1a9d040bd97b9bacbcb5aead589523bf60572e04slive with a single request will not affect any other.</p>
1a9d040bd97b9bacbcb5aead589523bf60572e04slive
1a9d040bd97b9bacbcb5aead589523bf60572e04slive <p>This MPM is very self-regulating, so it is rarely necessary to
1a9d040bd97b9bacbcb5aead589523bf60572e04slive adjust its configuration directives. Most important is that
1a9d040bd97b9bacbcb5aead589523bf60572e04slive <directive module="mpm_common">MaxClients</directive> be big enough to
1a9d040bd97b9bacbcb5aead589523bf60572e04slive handle as many simultaneous requests as you expect to receive, but
1a9d040bd97b9bacbcb5aead589523bf60572e04slive small enough to assure that there is enough physical RAM for all
1a9d040bd97b9bacbcb5aead589523bf60572e04slive processes.</p>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
1a9d040bd97b9bacbcb5aead589523bf60572e04slive</summary>
1a9d040bd97b9bacbcb5aead589523bf60572e04slive<seealso><a href="/bind.html">Setting which addresses and
1a9d040bd97b9bacbcb5aead589523bf60572e04slive ports Apache uses</a></seealso>
1a9d040bd97b9bacbcb5aead589523bf60572e04slive
1a9d040bd97b9bacbcb5aead589523bf60572e04slive<section><title>How it Works</title>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <p>A single control process is responsible for launching child
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive processes which listen for connections and serve them when they
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive arrive. Apache always tries to maintain several <em>spare</em>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive or idle server processes, which stand ready to serve incoming
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive requests. In this way, clients do not need to wait for a new
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive child processes to be forked before their requests can be
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive served.</p>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <p>The <directive module="mpm_common">StartServers</directive>,
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <directive module="prefork">MinSpareServers</directive>,
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <directive module="prefork">MaxSpareServers</directive>, and
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <directive module="mpm_common">MaxClients</directive> regulate how
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive the parent process creates children to serve requests. In general,
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive Apache is very self-regulating, so most sites do not need to
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive adjust these directives from their default values. Sites which
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive need to serve more than 256 simultaneous requests may need to
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive increase <directive module="mpm_common">MaxClients</directive>,
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive while sites with limited memory may need to decrease <directive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive module="mpm_common">MaxClients</directive> to keep the server from
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive thrashing (swapping memory to disk and back). More information
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive about tuning process creation is provided in the <a
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive href="/misc/perf-tuning.html">performance hints</a>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive documentation.</p>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <p>While the parent process is usually started as root under Unix
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive in order to bind to port 80, the child processes are launched by
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive Apache as a less-privileged user. The <directive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive module="mpm_common">User</directive> and <directive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive module="mpm_common">Group</directive> directives are used to set
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive the privileges of the Apache child processes. The child processes
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive must be able to read all the content that will be served, but
1a9d040bd97b9bacbcb5aead589523bf60572e04slive should have as few privileges beyond that as possible.</p>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <p><directive module="mpm_common">MaxRequestsPerChild</directive>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive controls how frequently the server recycles processes by killing
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive old ones and launching new ones.</p>
1a9d040bd97b9bacbcb5aead589523bf60572e04slive</section>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<directivesynopsis location="mpm_common">
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>CoreDumpDirectory</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<directivesynopsis location="mpm_common">
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>PidFile</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<directivesynopsis location="mpm_common">
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>Listen</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<directivesynopsis location="mpm_common">
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>ListenBacklog</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<directivesynopsis location="mpm_common">
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>LockFile</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
1a9d040bd97b9bacbcb5aead589523bf60572e04slive<directivesynopsis location="mpm_common">
1a9d040bd97b9bacbcb5aead589523bf60572e04slive<name>MaxClients</name>
1a9d040bd97b9bacbcb5aead589523bf60572e04slive</directivesynopsis>
1a9d040bd97b9bacbcb5aead589523bf60572e04slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<directivesynopsis location="mpm_common">
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>MaxRequestsPerChild</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<directivesynopsis location="mpm_common">
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>MaxSpareServers</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<directivesynopsis location="mpm_common">
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>MinSpareServers</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<directivesynopsis location="mpm_common">
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>ScoreBoardFile</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<directivesynopsis location="mpm_common">
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>SendBufferSize</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<directivesynopsis location="mpm_common">
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>ServerLimit</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<directivesynopsis location="mpm_common">
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>StartServers</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<directivesynopsis location="mpm_common">
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>User</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
1a9d040bd97b9bacbcb5aead589523bf60572e04slive<directivesynopsis location="mpm_common">
1a9d040bd97b9bacbcb5aead589523bf60572e04slive<name>Group</name>
1a9d040bd97b9bacbcb5aead589523bf60572e04slive</directivesynopsis>
1a9d040bd97b9bacbcb5aead589523bf60572e04slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>AcceptMutex</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<description>Method that Apache uses to serialize multiple children
fc88db23cb4b205f1efea5f5d5ae916589db5a61sliveaccepting requests on network sockets</description>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<syntax>AcceptMutex default|<em>method</em></syntax>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<default>AcceptMutex default</default>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<contextlist><context>server config</context></contextlist>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<usage>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <p>The <directive>AcceptMutex</directive> directives sets the
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive method that Apache uses to serialize multiple children accepting
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive requests on network sockets. Prior to Apache 2.0, the method was
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive selectable only at compile time. The optimal method to use is
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive highly architecture and platform dependent. For further details,
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive see the <a href="/misc/perf-tuning.html">performance tuning</a>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive documentation.</p>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <p>If this directive is set to <code>default</code>, then the
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive compile-time selected default will be used. Other possible
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive methods are listed below. Note that not all methods are
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive available on all platforms. If a method is specified which is
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive not available, a message will be written to the error log
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive listing the available methods.</p>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <dl>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <dt><code>flock</code></dt>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <dd>uses the <code>flock(2)</code> system call to lock the
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive file defined by the <directive module="mpm_common"
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive >LockFile</directive> directive.</dd>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <dt><code>fcntl</code></dt>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <dd>uses the <code>fnctl(2)</code> system call to lock the
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive file defined by the <directive module="mpm_common"
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive >LockFile</directive> directive.</dd>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <dt><code>sysvsem</code></dt>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <dd>uses SySV-style semaphores to implement the mutex.</dd>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <dt><code>pthread</code></dt>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <dd>uses POSIX mutexes as implemented by the POSIX Threads
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive (PThreads) specification.</dd>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive </dl>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</usage>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>MaxSpareServers</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<description>Maximum number of idle child server processes</description>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<syntax>MaxSpareServers <em>number</em><br /></syntax>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<default>MaxSpareServers 10</default>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<contextlist><context>server config</context></contextlist>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<usage>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <p>The <directive>MaxSpareServers</directive> directive sets the
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive desired maximum number of <em>idle</em> child server processes. An
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive idle process is one which is not handling a request. If there are
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive more than MaxSpareServers idle, then the parent process will kill
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive off the excess processes.</p>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <p>Tuning of this parameter should only be necessary on very
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive busy sites. Setting this parameter to a large number is almost
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive always a bad idea.</p>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</usage>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<seealso><directive module="prefork">MinSpareServers</directive></seealso>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<seealso><directive module="mpm_common">StartServers</directive></seealso>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<name>MinSpareServers</name>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<description>Minimum number of idle child server processes</description>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<syntax>MinSpareServers <em>number</em></syntax>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<default>MinSpareServers 5</default>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<contextlist><context>server config</context></contextlist>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<usage>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <p>The <directive>MinSpareServers</directive> directive sets the
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive desired minimum number of <em>idle</em> child server processes. An
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive idle process is one which is not handling a request. If there are
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive fewer than MinSpareServers idle, then the parent process creates
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive new children at a maximum rate of 1 per second.</p>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <p>Tuning of this parameter should only be necessary on very
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive busy sites. Setting this parameter to a large number is almost
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive always a bad idea.</p>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive <p>This directive has no effect on Microsoft Windows.</p>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</usage>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<seealso><directive module="prefork">MaxSpareServers</directive></seealso>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive<seealso><directive module="mpm_common">StartServers</directive></seealso>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</directivesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive</modulesynopsis>
fc88db23cb4b205f1efea5f5d5ae916589db5a61slive