]> granicus.if.org Git - apache/blob - docs/manual/mod/prefork.xml
Update copyright year to 2005 and standardize on current copyright owner line.
[apache] / docs / manual / mod / prefork.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
5
6 <!--
7  Copyright 2002-2005 The Apache Software Foundation or its licensors, as
8  applicable.
9
10  Licensed under the Apache License, Version 2.0 (the "License");
11  you may not use this file except in compliance with the License.
12  You may obtain a copy of the License at
13
14      http://www.apache.org/licenses/LICENSE-2.0
15
16  Unless required by applicable law or agreed to in writing, software
17  distributed under the License is distributed on an "AS IS" BASIS,
18  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  See the License for the specific language governing permissions and
20  limitations under the License.
21 -->
22
23 <modulesynopsis metafile="prefork.xml.meta">
24
25 <name>prefork</name>
26 <description>Implements a non-threaded, pre-forking web server</description>
27 <status>MPM</status>
28 <sourcefile>prefork.c</sourcefile>
29 <identifier>mpm_prefork_module</identifier>
30
31 <summary>
32     <p>This Multi-Processing Module (MPM) implements a non-threaded,
33     pre-forking web server that handles requests in a manner similar
34     to Apache 1.3.  It is appropriate for sites that need to avoid
35     threading for compatibility with non-thread-safe libraries.  It
36     is also the best MPM for isolating each request, so that a problem
37     with a single request will not affect any other.</p>
38
39     <p>This MPM is very self-regulating, so it is rarely necessary to
40     adjust its configuration directives.  Most important is that
41     <directive module="mpm_common">MaxClients</directive> be big enough to 
42     handle as many simultaneous requests as you expect to receive, but
43     small enough to assure that there is enough physical RAM for all
44     processes.</p>
45 </summary>
46 <seealso><a href="../bind.html">Setting which addresses and ports Apache
47 uses</a></seealso>
48
49 <section id="how-it-works"><title>How it Works</title>
50     <p>A single control process is responsible for launching child
51     processes which listen for connections and serve them when they
52     arrive. Apache always tries to maintain several <dfn>spare</dfn>
53     or idle server processes, which stand ready to serve incoming
54     requests. In this way, clients do not need to wait for a new
55     child processes to be forked before their requests can be
56     served.</p>
57
58     <p>The <directive module="mpm_common">StartServers</directive>,
59     <directive module="prefork">MinSpareServers</directive>,
60     <directive module="prefork">MaxSpareServers</directive>, and
61     <directive module="mpm_common">MaxClients</directive> regulate how
62     the parent process creates children to serve requests. In general,
63     Apache is very self-regulating, so most sites do not need to
64     adjust these directives from their default values. Sites which
65     need to serve more than 256 simultaneous requests may need to
66     increase <directive module="mpm_common">MaxClients</directive>,
67     while sites with limited memory may need to decrease <directive
68     module="mpm_common">MaxClients</directive> to keep the server from
69     thrashing (swapping memory to disk and back). More information
70     about tuning process creation is provided in the <a
71     href="../misc/perf-tuning.html">performance hints</a>
72     documentation.</p>
73
74     <p>While the parent process is usually started as <code>root</code>
75     under Unix in order to bind to port 80, the child processes are
76     launched by Apache as a less-privileged user. The <directive
77     module="mpm_common">User</directive> and <directive
78     module="mpm_common">Group</directive> directives are used to set
79     the privileges of the Apache child processes. The child processes
80     must be able to read all the content that will be served, but
81     should have as few privileges beyond that as possible.</p>
82
83     <p><directive module="mpm_common">MaxRequestsPerChild</directive>
84     controls how frequently the server recycles processes by killing
85     old ones and launching new ones.</p>
86 </section>
87
88 <directivesynopsis location="mpm_common"><name>CoreDumpDirectory</name>
89 </directivesynopsis>
90 <directivesynopsis location="mpm_common"><name>EnableExceptionHook</name>
91 </directivesynopsis>
92 <directivesynopsis location="mpm_common"><name>PidFile</name>
93 </directivesynopsis>
94 <directivesynopsis location="mpm_common"><name>Listen</name>
95 </directivesynopsis>
96 <directivesynopsis location="mpm_common"><name>ListenBacklog</name>
97 </directivesynopsis>
98 <directivesynopsis location="mpm_common"><name>LockFile</name>
99 </directivesynopsis>
100 <directivesynopsis location="mpm_common"><name>MaxClients</name>
101 </directivesynopsis>
102 <directivesynopsis location="mpm_common"><name>MaxMemFree</name>
103 </directivesynopsis>
104 <directivesynopsis location="mpm_common"><name>MaxRequestsPerChild</name>
105 </directivesynopsis>
106 <directivesynopsis location="mpm_common"><name>ScoreBoardFile</name>
107 </directivesynopsis>
108 <directivesynopsis location="mpm_common"><name>SendBufferSize</name>
109 </directivesynopsis>
110 <directivesynopsis location="mpm_common"><name>ServerLimit</name>
111 </directivesynopsis>
112 <directivesynopsis location="mpm_common"><name>StartServers</name>
113 </directivesynopsis>
114 <directivesynopsis location="mpm_common"><name>User</name>
115 </directivesynopsis>
116 <directivesynopsis location="mpm_common"><name>Group</name>
117 </directivesynopsis>
118 <directivesynopsis location="mpm_common"><name>AcceptMutex</name>
119 </directivesynopsis>
120
121 <directivesynopsis>
122 <name>MaxSpareServers</name>
123 <description>Maximum number of idle child server processes</description>
124 <syntax>MaxSpareServers <var>number</var></syntax>
125 <default>MaxSpareServers 10</default>
126 <contextlist><context>server config</context></contextlist>
127
128 <usage>
129     <p>The <directive>MaxSpareServers</directive> directive sets the
130     desired maximum number of <em>idle</em> child server processes. An
131     idle process is one which is not handling a request. If there are
132     more than <directive>MaxSpareServers</directive> idle, then the
133     parent process will kill off the excess processes.</p>
134
135     <p>Tuning of this parameter should only be necessary on very
136     busy sites. Setting this parameter to a large number is almost
137     always a bad idea. If you are trying to set the value equal to or lower than
138     <directive module="prefork">MinSpareServers</directive>, Apache
139     will automatically adjust it to <directive
140     >MinSpareServers</directive><code> + 1</code>.</p>
141 </usage>
142 <seealso><directive module="prefork">MinSpareServers</directive></seealso>
143 <seealso><directive module="mpm_common">StartServers</directive></seealso>
144 </directivesynopsis>
145
146 <directivesynopsis>
147 <name>MinSpareServers</name>
148 <description>Minimum number of idle child server processes</description>
149 <syntax>MinSpareServers <var>number</var></syntax>
150 <default>MinSpareServers 5</default>
151 <contextlist><context>server config</context></contextlist>
152
153 <usage>
154     <p>The <directive>MinSpareServers</directive> directive sets the
155     desired minimum number of <em>idle</em> child server processes. An
156     idle process is one which is not handling a request. If there are
157     fewer than <directive>MinSpareServers</directive> idle, then the parent
158     process creates new children at a maximum rate of 1 per second.</p>
159
160     <p>Tuning of this parameter should only be necessary on very
161     busy sites. Setting this parameter to a large number is almost
162     always a bad idea.</p>
163 </usage>
164 <seealso><directive module="prefork">MaxSpareServers</directive></seealso>
165 <seealso><directive module="mpm_common">StartServers</directive></seealso>
166 </directivesynopsis>
167
168 </modulesynopsis>
169