prefork.xml revision 5fe85d8662e07bb4e9dbe9c2d0274e90a3058135
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<?xml version="1.0"?>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
0a05fab9aadd37834734ffe106fc8ad4488fb3e3rbowen<!-- $LastChangedRevision$ -->
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<!--
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun Licensed to the Apache Software Foundation (ASF) under one or more
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun contributor license agreements. See the NOTICE file distributed with
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun this work for additional information regarding copyright ownership.
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun The ASF licenses this file to You under the Apache License, Version 2.0
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun (the "License"); you may not use this file except in compliance with
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun the License. You may obtain a copy of the License at
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun http://www.apache.org/licenses/LICENSE-2.0
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun Unless required by applicable law or agreed to in writing, software
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun distributed under the License is distributed on an "AS IS" BASIS,
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun See the License for the specific language governing permissions and
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun limitations under the License.
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun-->
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<modulesynopsis metafile="prefork.xml.meta">
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<name>prefork</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<description>Implements a non-threaded, pre-forking web server</description>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<status>MPM</status>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<sourcefile>prefork.c</sourcefile>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<identifier>mpm_prefork_module</identifier>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<summary>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun <p>This Multi-Processing Module (MPM) implements a non-threaded,
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun pre-forking web server that handles requests in a manner similar
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun to Apache 1.3. It is appropriate for sites that need to avoid
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun threading for compatibility with non-thread-safe libraries. It
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun is also the best MPM for isolating each request, so that a problem
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun with a single request will not affect any other.</p>
71c10d94d9dcec087859cdb44231ccc02ecaef9dnilgun
71c10d94d9dcec087859cdb44231ccc02ecaef9dnilgun <p>This MPM is very self-regulating, so it is rarely necessary to
71c10d94d9dcec087859cdb44231ccc02ecaef9dnilgun adjust its configuration directives. Most important is that
71c10d94d9dcec087859cdb44231ccc02ecaef9dnilgun <directive module="mpm_common">MaxClients</directive> be big enough to
71c10d94d9dcec087859cdb44231ccc02ecaef9dnilgun handle as many simultaneous requests as you expect to receive, but
71c10d94d9dcec087859cdb44231ccc02ecaef9dnilgun small enough to assure that there is enough physical RAM for all
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun processes.</p>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</summary>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<seealso><a href="/bind.html">Setting which addresses and ports Apache
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgunuses</a></seealso>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<section id="how-it-works"><title>How it Works</title>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun <p>A single control process is responsible for launching child
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun processes which listen for connections and serve them when they
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun arrive. Apache always tries to maintain several <dfn>spare</dfn>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun or idle server processes, which stand ready to serve incoming
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun requests. In this way, clients do not need to wait for a new
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun child processes to be forked before their requests can be
71c10d94d9dcec087859cdb44231ccc02ecaef9dnilgun served.</p>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun <p>The <directive module="mpm_common">StartServers</directive>,
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun <directive module="prefork">MinSpareServers</directive>,
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun <directive module="prefork">MaxSpareServers</directive>, and
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun <directive module="mpm_common">MaxClients</directive> regulate how
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun the parent process creates children to serve requests. In general,
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun Apache is very self-regulating, so most sites do not need to
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun adjust these directives from their default values. Sites which
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun need to serve more than 256 simultaneous requests may need to
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun increase <directive module="mpm_common">MaxClients</directive>,
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun while sites with limited memory may need to decrease <directive
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun module="mpm_common">MaxClients</directive> to keep the server from
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun thrashing (swapping memory to disk and back). More information
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun about tuning process creation is provided in the <a
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun href="/misc/perf-tuning.html">performance hints</a>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun documentation.</p>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun <p>While the parent process is usually started as <code>root</code>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun under Unix in order to bind to port 80, the child processes are
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun launched by Apache as a less-privileged user. The <directive
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun module="mod_unixd">User</directive> and <directive
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun module="mod_unixd">Group</directive> directives are used to set
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun the privileges of the Apache child processes. The child processes
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun must be able to read all the content that will be served, but
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun should have as few privileges beyond that as possible.</p>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun <p><directive module="mpm_common">MaxRequestsPerChild</directive>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun controls how frequently the server recycles processes by killing
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun old ones and launching new ones.</p>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun <p>This MPM uses the <code>mpm-accept</code> mutex to serialize
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun access to incoming connections when subject to the thundering herd
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun problem (generally, when there are multiple listening sockets).
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun The implementation aspects of this mutex can be configured with the
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun <directive module="core">Mutex</directive> directive. The <a
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun href="/misc/perf-tuning.html">performance hints</a>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun documentation has additional information about this mutex.</p>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</section>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis location="mpm_common"><name>CoreDumpDirectory</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis location="mpm_common"><name>EnableExceptionHook</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis location="mpm_common"><name>PidFile</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis location="mpm_common"><name>Listen</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis location="mpm_common"><name>ListenBacklog</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis location="mpm_common"><name>MaxClients</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis location="mpm_common"><name>MaxMemFree</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis location="mpm_common"><name>MaxRequestsPerChild</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis location="mpm_common"><name>ScoreBoardFile</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis location="mpm_common"><name>ReceiveBufferSize</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis location="mpm_common"><name>SendBufferSize</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis location="mpm_common"><name>ServerLimit</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis location="mpm_common"><name>StartServers</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis location="mod_unixd"><name>User</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis location="mod_unixd"><name>Group</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<name>MaxSpareServers</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<description>Maximum number of idle child server processes</description>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<syntax>MaxSpareServers <var>number</var></syntax>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<default>MaxSpareServers 10</default>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<contextlist><context>server config</context></contextlist>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<usage>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun <p>The <directive>MaxSpareServers</directive> directive sets the
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun desired maximum number of <em>idle</em> child server processes. An
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun idle process is one which is not handling a request. If there are
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun more than <directive>MaxSpareServers</directive> idle, then the
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun parent process will kill off the excess processes.</p>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun <p>Tuning of this parameter should only be necessary on very
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun busy sites. Setting this parameter to a large number is almost
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun always a bad idea. If you are trying to set the value equal to or lower than
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun <directive module="prefork">MinSpareServers</directive>, Apache
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun will automatically adjust it to <directive
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun >MinSpareServers</directive><code> + 1</code>.</p>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</usage>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<seealso><directive module="prefork">MinSpareServers</directive></seealso>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<seealso><directive module="mpm_common">StartServers</directive></seealso>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<seealso><directive module="mpm_common">MaxSpareThreads</directive></seealso>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<name>MinSpareServers</name>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<description>Minimum number of idle child server processes</description>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<syntax>MinSpareServers <var>number</var></syntax>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<default>MinSpareServers 5</default>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<contextlist><context>server config</context></contextlist>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<usage>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun <p>The <directive>MinSpareServers</directive> directive sets the
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun desired minimum number of <em>idle</em> child server processes. An
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun idle process is one which is not handling a request. If there are
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun fewer than <directive>MinSpareServers</directive> idle, then the parent
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun process creates new children at a maximum rate of 1 per second.</p>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun <p>Tuning of this parameter should only be necessary on very
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun busy sites. Setting this parameter to a large number is almost
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun always a bad idea.</p>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</usage>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<seealso><directive module="prefork">MaxSpareServers</directive></seealso>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<seealso><directive module="mpm_common">StartServers</directive></seealso>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun<seealso><directive module="mpm_common">MinSpareThreads</directive></seealso>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</directivesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun</modulesynopsis>
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun
34be775b7fb103ca189f3a38979f46ce8a74ef68nilgun