]> granicus.if.org Git - apache/blob - docs/manual/mod/prefork.xml
Start converting the mpm documentation.
[apache] / docs / manual / mod / prefork.xml
1 <?xml version="1.0"?>
2 <?xml-stylesheet type="text/xsl" href="../style/manual.xsl"?>
3 <modulesynopsis>
4 <name>prefork</name>
5 <description>Implements a non-threaded, pre-forking web server</description>
6 <status>MPM</status>
7 <sourcefile>prefork.c</sourcefile>
8 <identifier>mpm_prefork_module</identifier>
9
10 <summary>
11     <p>This Multi-Processing Module (MPM) implements a
12     non-threaded, pre-forking web server which handles request in a
13     manner very similar to the default behavior of Apache 1.3 on
14     Unix.</p>
15
16     <p>A single control process is responsible for launching child
17     processes which listen for connections and serve them when they
18     arrive. Apache always tries to maintain several <em>spare</em>
19     or idle server processes, which stand ready to serve incoming
20     requests. In this way, clients do not need to wait for a new
21     child processes to be forked before their requests can be
22     served.</p>
23
24     <p>The <directive module="mpm_common">StartServers</directive>,
25     <directive module="prefork">MinSpareServers</directive>,
26     <directive module="prefork">MaxSpareServers</directive>, and
27     <directive module="mpm_common">MaxClients</directive> regulate how
28     the parent process creates children to serve requests. In general,
29     Apache is very self-regulating, so most sites do not need to
30     adjust these directives from their default values. Sites which
31     need to serve more than 256 simultaneous requests may need to
32     increase <directive module="mpm_common">MaxClients</directive>,
33     while sites with limited memory may need to decrease <directive
34     module="mpm_common">MaxClients</directive> to keep the server from
35     thrashing (swapping memory to disk and back). More information
36     about tuning process creation is provided in the <a
37     href="../misc/perf-tuning.html">performance hints</a>
38     documentation.</p>
39
40     <p>While the parent process is usually started as root under Unix
41     in order to bind to port 80, the child processes are launched by
42     Apache as a less-privileged user. The <directive
43     module="mpm_common">User</directive> and <directive
44     module="mpm_common">Group</directive> directives are used to set
45     the privileges of the Apache child processes. The child processes
46     must be able to read all the content that will be served, but
47     should have as few privileges beyond that as possible. In
48     addition, unless <a href="../suexec.html">suexec</a> is used,
49     these directives also set the privileges which will be inherited
50     by CGI scripts.</p>
51
52     <p><directive module="mpm_common">MaxRequestsPerChild</directive>
53     controls how frequently the server recycles processes by killing
54     old ones and launching new ones.</p>
55 </summary>
56 <seealso><a href="../bind.html">Setting which addresses and
57     ports Apache uses</a></seealso>
58
59 <directivesynopsis location="mpm_common">
60 <name>CoreDumpDirectory</name>
61 </directivesynopsis>
62
63 <directivesynopsis location="mpm_common">
64 <name>PidFile</name>
65 </directivesynopsis>
66
67 <directivesynopsis location="mpm_common">
68 <name>Listen</name>
69 </directivesynopsis>
70
71 <directivesynopsis location="mpm_common">
72 <name>ListenBacklog</name>
73 </directivesynopsis>
74
75 <directivesynopsis location="mpm_common">
76 <name>LockFile</name>
77 </directivesynopsis>
78
79 <directivesynopsis location="mpm_common">
80 <name>MaxRequestsPerChild</name>
81 </directivesynopsis>
82
83 <directivesynopsis location="mpm_common">
84 <name>MaxSpareServers</name>
85 </directivesynopsis>
86
87 <directivesynopsis location="mpm_common">
88 <name>MinSpareServers</name>
89 </directivesynopsis>
90
91 <directivesynopsis location="mpm_common">
92 <name>ScoreBoardFile</name>
93 </directivesynopsis>
94
95 <directivesynopsis location="mpm_common">
96 <name>SendBufferSize</name>
97 </directivesynopsis>
98
99 <directivesynopsis location="mpm_common">
100 <name>ServerLimit</name>
101 </directivesynopsis>
102
103 <directivesynopsis location="mpm_common">
104 <name>StartServers</name>
105 </directivesynopsis>
106
107 <directivesynopsis location="mpm_common">
108 <name>User</name>
109 </directivesynopsis>
110
111 <directivesynopsis>
112 <name>AcceptMutex</name>
113 <description>Method that Apache uses to serialize multiple children
114 accepting requests on network sockets</description>
115 <syntax>AcceptMutex default|<em>method</em></syntax>
116 <default>AcceptMutex default</default>
117 <contextlist><context>server config</context></contextlist>
118
119 <usage>
120     <p>The <directive>AcceptMutex</directive> directives sets the
121     method that Apache uses to serialize multiple children accepting
122     requests on network sockets. Prior to Apache 2.0, the method was
123     selectable only at compile time. The optimal method to use is
124     highly architecture and platform dependent. For further details,
125     see the <a href="../misc/perf-tuning.html">performance tuning</a>
126     documentation.</p>
127
128     <p>If this directive is set to <code>default</code>, then the
129     compile-time selected default will be used. Other possible
130     methods are listed below. Note that not all methods are
131     available on all platforms. If a method is specified which is
132     not available, a message will be written to the error log
133     listing the available methods.</p>
134
135     <dl>
136       <dt><code>flock</code></dt>
137
138       <dd>uses the <code>flock(2)</code> system call to lock the
139       file defined by the <directive module="mpm_common"
140       >LockFile</directive> directive.</dd>
141
142       <dt><code>fcntl</code></dt>
143
144       <dd>uses the <code>fnctl(2)</code> system call to lock the
145       file defined by the <directive module="mpm_common"
146       >LockFile</directive> directive.</dd>
147
148       <dt><code>sysvsem</code></dt>
149
150       <dd>uses SySV-style semaphores to implement the mutex.</dd>
151
152       <dt><code>pthread</code></dt>
153
154       <dd>uses POSIX mutexes as implemented by the POSIX Threads
155       (PThreads) specification.</dd>
156     </dl>
157 </usage>
158 </directivesynopsis>
159
160 <directivesynopsis>
161 <name>MaxSpareServers</name>
162 <description>Maximum number of idle child server processes</description>
163 <syntax>MaxSpareServers <em>number</em><br /></syntax>
164 <default>MaxSpareServers 10</default>
165 <contextlist><context>server config</context></contextlist>
166
167 <usage>
168     <p>The <directive>MaxSpareServers</directive> directive sets the
169     desired maximum number of <em>idle</em> child server processes. An
170     idle process is one which is not handling a request. If there are
171     more than MaxSpareServers idle, then the parent process will kill
172     off the excess processes.</p>
173
174     <p>Tuning of this parameter should only be necessary on very
175     busy sites. Setting this parameter to a large number is almost
176     always a bad idea.</p>
177 </usage>
178 <seealso><directive module="prefork">MinSpareServers</directive></seealso>
179 <seealso><directive module="mpm_common">StartServers</directive></seealso>
180 </directivesynopsis>
181
182 <directivesynopsis>
183 <name>MinSpareServers</name>
184 <description>Minimum number of idle child server processes</description>
185 <syntax>MinSpareServers <em>number</em></syntax>
186 <default>MinSpareServers  5</default>
187 <contextlist><context>server config</context></contextlist>
188
189 <usage>
190     <p>The <directive>MinSpareServers</directive> directive sets the
191     desired minimum number of <em>idle</em> child server processes. An
192     idle process is one which is not handling a request. If there are
193     fewer than MinSpareServers idle, then the parent process creates
194     new children at a maximum rate of 1 per second.</p>
195
196     <p>Tuning of this parameter should only be necessary on very
197     busy sites. Setting this parameter to a large number is almost
198     always a bad idea.</p>
199
200     <p>This directive has no effect on Microsoft Windows.</p>
201 </usage>
202 <seealso><directive module="prefork">MaxSpareServers</directive></seealso>
203 <seealso><directive module="mpm_common">StartServers</directive></seealso>
204 </directivesynopsis>
205
206 </modulesynopsis>
207