prefork.xml revision cc934828f4a719743a3387516f6fa71dd2cc88ff
55c79512242fd281202cd57ca18defac696440f5kess<?xml version="1.0"?>
55c79512242fd281202cd57ca18defac696440f5kess<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
55c79512242fd281202cd57ca18defac696440f5kess<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
55c79512242fd281202cd57ca18defac696440f5kess<!-- $LastChangedRevision$ -->
55c79512242fd281202cd57ca18defac696440f5kess
55c79512242fd281202cd57ca18defac696440f5kess<!--
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd Copyright 2002-2005 The Apache Software Foundation or its licensors, as
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd applicable.
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd Licensed under the Apache License, Version 2.0 (the "License");
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd you may not use this file except in compliance with the License.
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd You may obtain a copy of the License at
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd http://www.apache.org/licenses/LICENSE-2.0
27e52281f1522522b170cafc76b08b58aa70ccaand
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd Unless required by applicable law or agreed to in writing, software
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd distributed under the License is distributed on an "AS IS" BASIS,
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4b5981e276e93df97c34e4da05ca5cf8bbd937dand See the License for the specific language governing permissions and
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd limitations under the License.
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd-->
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd
b05ab3ff5ab54aa22610b13d56eaba6ddfc3db60nd<modulesynopsis metafile="prefork.xml.meta">
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<name>prefork</name>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<description>Implements a non-threaded, pre-forking web server</description>
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd<status>MPM</status>
55c79512242fd281202cd57ca18defac696440f5kess<sourcefile>prefork.c</sourcefile>
55c79512242fd281202cd57ca18defac696440f5kess<identifier>mpm_prefork_module</identifier>
55c79512242fd281202cd57ca18defac696440f5kess
55c79512242fd281202cd57ca18defac696440f5kess<summary>
55c79512242fd281202cd57ca18defac696440f5kess <p>This Multi-Processing Module (MPM) implements a non-threaded,
55c79512242fd281202cd57ca18defac696440f5kess pre-forking web server that handles requests in a manner similar
1ce7f356a70d1d9961ec315c212e2f83a1452456nd to Apache 1.3. It is appropriate for sites that need to avoid
8f057347a12e831fdf567da83de2fa581580298dnd threading for compatibility with non-thread-safe libraries. It
5b10fd3977e6dfff19afe770e612e276962f7950nd is also the best MPM for isolating each request, so that a problem
5b10fd3977e6dfff19afe770e612e276962f7950nd with a single request will not affect any other.</p>
8f057347a12e831fdf567da83de2fa581580298dnd
8f057347a12e831fdf567da83de2fa581580298dnd <p>This MPM is very self-regulating, so it is rarely necessary to
8f057347a12e831fdf567da83de2fa581580298dnd adjust its configuration directives. Most important is that
8f057347a12e831fdf567da83de2fa581580298dnd <directive module="mpm_common">MaxClients</directive> be big enough to
8f057347a12e831fdf567da83de2fa581580298dnd handle as many simultaneous requests as you expect to receive, but
8f057347a12e831fdf567da83de2fa581580298dnd small enough to assure that there is enough physical RAM for all
1ce7f356a70d1d9961ec315c212e2f83a1452456nd processes.</p>
5b10fd3977e6dfff19afe770e612e276962f7950nd</summary>
5b10fd3977e6dfff19afe770e612e276962f7950nd<seealso><a href="/bind.html">Setting which addresses and ports Apache
1ce7f356a70d1d9961ec315c212e2f83a1452456nduses</a></seealso>
2fc082b48b1bfb1182d6b93f5837e74b0c0af3eckess
2fc082b48b1bfb1182d6b93f5837e74b0c0af3eckess<section id="how-it-works"><title>How it Works</title>
74086452b5093fa1a58446034c6ddfd67dab5651kess <p>A single control process is responsible for launching child
74086452b5093fa1a58446034c6ddfd67dab5651kess processes which listen for connections and serve them when they
de502b36947f981bb79c4b3529b9f9f5edf35b2dkess arrive. Apache always tries to maintain several <dfn>spare</dfn>
de502b36947f981bb79c4b3529b9f9f5edf35b2dkess or idle server processes, which stand ready to serve incoming
b3c7a2279fa7a45f5807d9a404760b9b3760df50nd requests. In this way, clients do not need to wait for a new
b3c7a2279fa7a45f5807d9a404760b9b3760df50nd child processes to be forked before their requests can be
8ba890719035fe67c295c9124693138f9c5aa933kess served.</p>
8ba890719035fe67c295c9124693138f9c5aa933kess
55c79512242fd281202cd57ca18defac696440f5kess <p>The <directive module="mpm_common">StartServers</directive>,
55c79512242fd281202cd57ca18defac696440f5kess <directive module="prefork">MinSpareServers</directive>,
8f057347a12e831fdf567da83de2fa581580298dnd <directive module="prefork">MaxSpareServers</directive>, and
8f057347a12e831fdf567da83de2fa581580298dnd <directive module="mpm_common">MaxClients</directive> regulate how
8f057347a12e831fdf567da83de2fa581580298dnd the parent process creates children to serve requests. In general,
62664c6703ed9e8d8f4f8e4c5f5e893559ecefecnd Apache is very self-regulating, so most sites do not need to
62664c6703ed9e8d8f4f8e4c5f5e893559ecefecnd adjust these directives from their default values. Sites which
8f057347a12e831fdf567da83de2fa581580298dnd need to serve more than 256 simultaneous requests may need to
8f057347a12e831fdf567da83de2fa581580298dnd increase <directive module="mpm_common">MaxClients</directive>,
cf60fc8ad0f3a8f4b08351a2a3e346e0662af010nd while sites with limited memory may need to decrease <directive
eac1d56b0c6d54ddf717d035f808bdfa61e8bd14nd module="mpm_common">MaxClients</directive> to keep the server from
b8670d4ea3a3efcd12c3e1eddf68ef6fabef49fend thrashing (swapping memory to disk and back). More information
b8670d4ea3a3efcd12c3e1eddf68ef6fabef49fend about tuning process creation is provided in the <a
1ce7f356a70d1d9961ec315c212e2f83a1452456nd href="/misc/perf-tuning.html">performance hints</a>
1ce7f356a70d1d9961ec315c212e2f83a1452456nd documentation.</p>
1ce7f356a70d1d9961ec315c212e2f83a1452456nd
db99fa79ac42b9cc42b63386eb289aecb0f3cb9cnd <p>While the parent process is usually started as <code>root</code>
22d5d84393d960a2027f472036f3fee15d7dbce9nd under Unix in order to bind to port 80, the child processes are
22d5d84393d960a2027f472036f3fee15d7dbce9nd launched by Apache as a less-privileged user. The <directive
22d5d84393d960a2027f472036f3fee15d7dbce9nd module="mpm_common">User</directive> and <directive
5a98f1b67de38575f3903a03fc5120062b814371kess module="mpm_common">Group</directive> directives are used to set
55c79512242fd281202cd57ca18defac696440f5kess the privileges of the Apache child processes. The child processes
55c79512242fd281202cd57ca18defac696440f5kess must be able to read all the content that will be served, but
55c79512242fd281202cd57ca18defac696440f5kess should have as few privileges beyond that as possible.</p>
55c79512242fd281202cd57ca18defac696440f5kess
0beb4cd8984235bc220c768f6541bff0218bf96bnd <p><directive module="mpm_common">MaxRequestsPerChild</directive>
0beb4cd8984235bc220c768f6541bff0218bf96bnd controls how frequently the server recycles processes by killing
55c79512242fd281202cd57ca18defac696440f5kess old ones and launching new ones.</p>
55c79512242fd281202cd57ca18defac696440f5kess</section>
635e08c1d8332adc365b1c20bbe3577d59ebcd78kess
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>CoreDumpDirectory</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
ffb88a4885747797937e30a5ac8b1606da3cb4adnd<directivesynopsis location="mpm_common"><name>EnableExceptionHook</name>
909ce17e2bd0faef7b1c294f2307f009793fd493nd</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>PidFile</name>
312d4192f2e32167a1e750034664f1e3c2105c65nd</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>Listen</name>
42af92a661a06b3cebc88d585aad75064a309d51nd</directivesynopsis>
42af92a661a06b3cebc88d585aad75064a309d51nd<directivesynopsis location="mpm_common"><name>ListenBacklog</name>
ffb88a4885747797937e30a5ac8b1606da3cb4adnd</directivesynopsis>
6fe26506780e73be2a412d758af77fafdf03291and<directivesynopsis location="mpm_common"><name>LockFile</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
312d4192f2e32167a1e750034664f1e3c2105c65nd<directivesynopsis location="mpm_common"><name>MaxClients</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>MaxMemFree</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
0203b896e484dfb877111aceffb812401d0f216and<directivesynopsis location="mpm_common"><name>MaxRequestsPerChild</name>
312d4192f2e32167a1e750034664f1e3c2105c65nd</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>ScoreBoardFile</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>ReceiveBufferSize</name>
1ce7f356a70d1d9961ec315c212e2f83a1452456nd</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>SendBufferSize</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>ServerLimit</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>StartServers</name>
1ce7f356a70d1d9961ec315c212e2f83a1452456nd</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>User</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
05ede5110427cb9dc071cc671d5aaba5d3b88c79nd<directivesynopsis location="mpm_common"><name>Group</name>
e8b603fa9ccf7b17b11b42df6d8916fd97c2331dnd</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis location="mpm_common"><name>AcceptMutex</name>
55c79512242fd281202cd57ca18defac696440f5kess</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess<name>MaxSpareServers</name>
611049e38bfbaeb173d2d7fab2e44a48753436a1nd<description>Maximum number of idle child server processes</description>
1ce7f356a70d1d9961ec315c212e2f83a1452456nd<syntax>MaxSpareServers <var>number</var></syntax>
55c79512242fd281202cd57ca18defac696440f5kess<default>MaxSpareServers 10</default>
55c79512242fd281202cd57ca18defac696440f5kess<contextlist><context>server config</context></contextlist>
55c79512242fd281202cd57ca18defac696440f5kess
55c79512242fd281202cd57ca18defac696440f5kess<usage>
d8b761beec42bbe2847bb14e3b706642c6eed47cnd <p>The <directive>MaxSpareServers</directive> directive sets the
d8b761beec42bbe2847bb14e3b706642c6eed47cnd desired maximum number of <em>idle</em> child server processes. An
d8b761beec42bbe2847bb14e3b706642c6eed47cnd idle process is one which is not handling a request. If there are
55c79512242fd281202cd57ca18defac696440f5kess more than <directive>MaxSpareServers</directive> idle, then the
55c79512242fd281202cd57ca18defac696440f5kess parent process will kill off the excess processes.</p>
1ce7f356a70d1d9961ec315c212e2f83a1452456nd
03a4ff9ac4c9b8009249010e7c53bb86ff05915and <p>Tuning of this parameter should only be necessary on very
1ce7f356a70d1d9961ec315c212e2f83a1452456nd busy sites. Setting this parameter to a large number is almost
55c79512242fd281202cd57ca18defac696440f5kess always a bad idea. If you are trying to set the value equal to or lower than
0203b896e484dfb877111aceffb812401d0f216and <directive module="prefork">MinSpareServers</directive>, Apache
6329991d5f023c1c4ae02cfbbda636c66e6392aand will automatically adjust it to <directive
55c79512242fd281202cd57ca18defac696440f5kess >MinSpareServers</directive><code> + 1</code>.</p>
55c79512242fd281202cd57ca18defac696440f5kess</usage>
55c79512242fd281202cd57ca18defac696440f5kess<seealso><directive module="prefork">MinSpareServers</directive></seealso>
55c79512242fd281202cd57ca18defac696440f5kess<seealso><directive module="mpm_common">StartServers</directive></seealso>
1ce7f356a70d1d9961ec315c212e2f83a1452456nd</directivesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess
55c79512242fd281202cd57ca18defac696440f5kess<directivesynopsis>
d2b809e5d72658bff23819d8b77f20e4939af541nd<name>MinSpareServers</name>
55c79512242fd281202cd57ca18defac696440f5kess<description>Minimum number of idle child server processes</description>
1ce7f356a70d1d9961ec315c212e2f83a1452456nd<syntax>MinSpareServers <var>number</var></syntax>
55c79512242fd281202cd57ca18defac696440f5kess<default>MinSpareServers 5</default>
55c79512242fd281202cd57ca18defac696440f5kess<contextlist><context>server config</context></contextlist>
55c79512242fd281202cd57ca18defac696440f5kess
55c79512242fd281202cd57ca18defac696440f5kess<usage>
55c79512242fd281202cd57ca18defac696440f5kess <p>The <directive>MinSpareServers</directive> directive sets the
55c79512242fd281202cd57ca18defac696440f5kess desired minimum number of <em>idle</em> child server processes. An
1ce7f356a70d1d9961ec315c212e2f83a1452456nd idle process is one which is not handling a request. If there are
c023f60e35022146373e40249f0c8c8d623b6fcfnd fewer than <directive>MinSpareServers</directive> idle, then the parent
1ce7f356a70d1d9961ec315c212e2f83a1452456nd process creates new children at a maximum rate of 1 per second.</p>
a43bfa789f4e52dde53ae8e53fa0427b5c1cf977nd
a43bfa789f4e52dde53ae8e53fa0427b5c1cf977nd <p>Tuning of this parameter should only be necessary on very
28c9d384aa958b321280b4ac886941dcad25396bnd busy sites. Setting this parameter to a large number is almost
240e1b440b19476ecaa4aa9ff8d79afef74cb14and always a bad idea.</p>
240e1b440b19476ecaa4aa9ff8d79afef74cb14and</usage>
240e1b440b19476ecaa4aa9ff8d79afef74cb14and<seealso><directive module="prefork">MaxSpareServers</directive></seealso>
240e1b440b19476ecaa4aa9ff8d79afef74cb14and<seealso><directive module="mpm_common">StartServers</directive></seealso>
240e1b440b19476ecaa4aa9ff8d79afef74cb14and</directivesynopsis>
240e1b440b19476ecaa4aa9ff8d79afef74cb14and
1ce7f356a70d1d9961ec315c212e2f83a1452456nd</modulesynopsis>
55c79512242fd281202cd57ca18defac696440f5kess
1ce7f356a70d1d9961ec315c212e2f83a1452456nd