]> granicus.if.org Git - apache/blob - docs/manual/mod/mpm_common.html.en
Xforms
[apache] / docs / manual / mod / mpm_common.html.en
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
4 <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
5 <!--
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7               This file is generated from xml source: DO NOT EDIT
8         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
9       -->
10 <title>mpm_common - Apache HTTP Server Version 2.5</title>
11 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
12 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
13 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
14 <script src="../style/scripts/prettify.min.js" type="text/javascript">
15 </script>
16
17 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
18 <body>
19 <div id="page-header">
20 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
21 <p class="apache">Apache HTTP Server Version 2.5</p>
22 <img alt="" src="../images/feather.gif" /></div>
23 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
24 <div id="path">
25 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.5</a> &gt; <a href="./">Modules</a></div>
26 <div id="page-content">
27 <div id="preamble"><h1>Apache MPM Common Directives</h1>
28 <div class="toplang">
29 <p><span>Available Languages: </span><a href="../de/mod/mpm_common.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
30 <a href="../en/mod/mpm_common.html" title="English">&nbsp;en&nbsp;</a> |
31 <a href="../ja/mod/mpm_common.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
32 <a href="../tr/mod/mpm_common.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
33 </div>
34 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>A collection of directives that are implemented by
35 more than one multi-processing module (MPM)</td></tr>
36 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>MPM</td></tr></table>
37 </div>
38 <div id="quickview"><h3 class="directives">Directives</h3>
39 <ul id="toc">
40 <li><img alt="" src="../images/down.gif" /> <a href="#coredumpdirectory">CoreDumpDirectory</a></li>
41 <li><img alt="" src="../images/down.gif" /> <a href="#enableexceptionhook">EnableExceptionHook</a></li>
42 <li><img alt="" src="../images/down.gif" /> <a href="#gracefulshutdowntimeout">GracefulShutdownTimeout</a></li>
43 <li><img alt="" src="../images/down.gif" /> <a href="#listen">Listen</a></li>
44 <li><img alt="" src="../images/down.gif" /> <a href="#listenbacklog">ListenBackLog</a></li>
45 <li><img alt="" src="../images/down.gif" /> <a href="#listencoresbucketsratio">ListenCoresBucketsRatio</a></li>
46 <li><img alt="" src="../images/down.gif" /> <a href="#maxconnectionsperchild">MaxConnectionsPerChild</a></li>
47 <li><img alt="" src="../images/down.gif" /> <a href="#maxmemfree">MaxMemFree</a></li>
48 <li><img alt="" src="../images/down.gif" /> <a href="#maxrequestworkers">MaxRequestWorkers</a></li>
49 <li><img alt="" src="../images/down.gif" /> <a href="#maxsparethreads">MaxSpareThreads</a></li>
50 <li><img alt="" src="../images/down.gif" /> <a href="#minsparethreads">MinSpareThreads</a></li>
51 <li><img alt="" src="../images/down.gif" /> <a href="#pidfile">PidFile</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#receivebuffersize">ReceiveBufferSize</a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#scoreboardfile">ScoreBoardFile</a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#sendbuffersize">SendBufferSize</a></li>
55 <li><img alt="" src="../images/down.gif" /> <a href="#serverlimit">ServerLimit</a></li>
56 <li><img alt="" src="../images/down.gif" /> <a href="#startservers">StartServers</a></li>
57 <li><img alt="" src="../images/down.gif" /> <a href="#startthreads">StartThreads</a></li>
58 <li><img alt="" src="../images/down.gif" /> <a href="#threadlimit">ThreadLimit</a></li>
59 <li><img alt="" src="../images/down.gif" /> <a href="#threadsperchild">ThreadsPerChild</a></li>
60 <li><img alt="" src="../images/down.gif" /> <a href="#threadstacksize">ThreadStackSize</a></li>
61 </ul>
62 <ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
63
64 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
65 <div class="directive-section"><h2><a name="CoreDumpDirectory" id="CoreDumpDirectory">CoreDumpDirectory</a> <a name="coredumpdirectory" id="coredumpdirectory">Directive</a></h2>
66 <table class="directive">
67 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory where Apache HTTP Server attempts to
68 switch before dumping core</td></tr>
69 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CoreDumpDirectory <var>directory</var></code></td></tr>
70 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for the default setting</code></td></tr>
71 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
72 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
73 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
74 </table>
75     <p>This controls the directory to which Apache httpd attempts to
76     switch before dumping core. If your operating system is configured to
77     create core files in the working directory of the crashing process,
78     <code class="directive">CoreDumpDirectory</code> is necessary to change working
79     directory from the default <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>
80     directory, which should not be writable by the user the server runs as.</p>
81
82     <p>If you want a core dump for debugging, you can use this directive to
83     place it in a different location. This directive has no effect if your
84     operating system is not configured to write core files to the working directory
85     of the crashing processes.</p>
86
87     <div class="note"><h3>Core Dumps on Linux</h3>
88       <p>If Apache httpd starts as root and switches to another user, the
89       Linux kernel <em>disables</em> core dumps even if the directory is
90       writable for the process. Apache httpd (2.0.46 and later) reenables core dumps
91       on Linux 2.4 and beyond, but only if you explicitly configure a <code class="directive">CoreDumpDirectory</code>.</p>
92     </div>
93
94     <div class="note">
95     <h3>Core Dumps on BSD</h3>
96     <p>To enable core-dumping of suid-executables on BSD-systems (such
97     as FreeBSD), set <code>kern.sugid_coredump</code> to 1.
98     </p>
99     </div>
100
101     <div class="note"><h3>Specific signals</h3>
102       <p><code class="directive">CoreDumpDirectory</code> processing only occurs for
103       a select set of fatal signals: SIGFPE, SIGILL, SIGABORT,
104       SIGSEGV, and SIGBUS.</p>
105       <p>On some operating systems, SIGQUIT also results in a core dump but
106       does not go through <code class="directive">CoreDumpDirectory</code> or
107       <code class="directive">EnableExceptionHook</code> processing, so the core
108       location is dictated entirely by the operating system.</p>
109     </div>
110
111
112 </div>
113 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
114 <div class="directive-section"><h2><a name="EnableExceptionHook" id="EnableExceptionHook">EnableExceptionHook</a> <a name="enableexceptionhook" id="enableexceptionhook">Directive</a></h2>
115 <table class="directive">
116 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables a hook that runs exception handlers
117 after a crash</td></tr>
118 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableExceptionHook On|Off</code></td></tr>
119 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableExceptionHook Off</code></td></tr>
120 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
121 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
122 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
123 </table>
124     <p>For safety reasons this directive is only available if the server was
125     configured with the <code>--enable-exception-hook</code> option. It
126     enables a hook that allows external modules to plug in and do something
127     after a child crashed.</p>
128
129     <p>There are already two modules, <code>mod_whatkilledus</code> and
130     <code>mod_backtrace</code> that make use of this hook. Please have a
131     look at Jeff Trawick's <a href="http://people.apache.org/~trawick/exception_hook.html">EnableExceptionHook site</a> for more information about these.</p>
132
133 </div>
134 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
135 <div class="directive-section"><h2><a name="GracefulShutdownTimeout" id="GracefulShutdownTimeout">GracefulShutdownTimeout</a> <a name="gracefulshutdowntimeout" id="gracefulshutdowntimeout">Directive</a></h2>
136 <table class="directive">
137 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify a timeout after which a gracefully shutdown server
138 will exit.</td></tr>
139 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>GracefulShutdownTimeout <var>seconds</var></code></td></tr>
140 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>GracefulShutdownTimeout 0</code></td></tr>
141 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
142 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
143 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
144 </table>
145     <p>The <code class="directive">GracefulShutdownTimeout</code> specifies
146     how many seconds after receiving a "graceful-stop" signal, a
147     server should continue to run, handling the existing connections.</p>
148
149     <p>Setting this value to zero means that the server will wait
150     indefinitely until all remaining requests have been fully served.</p>
151
152 </div>
153 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
154 <div class="directive-section"><h2><a name="Listen" id="Listen">Listen</a> <a name="listen" id="listen">Directive</a></h2>
155 <table class="directive">
156 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>IP addresses and ports that the server
157 listens to</td></tr>
158 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Listen [<var>IP-address</var>:]<var>portnumber</var> [<var>protocol</var>]</code></td></tr>
159 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
160 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
161 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
162 </table>
163     <p>The <code class="directive">Listen</code> directive instructs Apache httpd to
164     listen to only specific IP addresses or ports; by default it
165     responds to requests on all IP interfaces. <code class="directive">Listen</code>
166     is now a required directive. If it is not in the config file, the
167     server will fail to start. This is a change from previous versions
168     of Apache httpd.</p>
169
170     <p>The <code class="directive">Listen</code> directive tells the server to
171     accept incoming requests on the specified port or address-and-port
172     combination. If only a port number is specified, the server listens to
173     the given port on all interfaces. If an IP address is given as well
174     as a port, the server will listen on the given port and
175     interface.</p>
176
177     <p>Multiple <code class="directive">Listen</code> directives may be used to
178     specify a number of addresses and ports to listen to. The server will
179     respond to requests from any of the listed addresses and ports.</p>
180
181     <p>For example, to make the server accept connections on both
182     port 80 and port 8000, use:</p>
183
184     <pre class="prettyprint lang-config">Listen 80
185 Listen 8000</pre>
186
187
188     <p>To make the server accept connections on two specified
189     interfaces and port numbers, use </p>
190
191     <pre class="prettyprint lang-config">Listen 192.170.2.1:80
192 Listen 192.170.2.5:8000</pre>
193
194
195     <p>IPv6 addresses must be surrounded in square brackets, as in the
196     following example:</p>
197
198     <pre class="prettyprint lang-config">Listen [2001:db8::a00:20ff:fea7:ccea]:80</pre>
199
200
201     <p>The optional <var>protocol</var> argument is not required for most
202        configurations. If not specified, <code>https</code> is the default for
203        port 443 and <code>http</code> the default for all other ports.  The
204        protocol is used to determine which module should handle a request, and
205        to apply protocol specific optimizations with the
206        <code class="directive"><a href="../mod/core.html#acceptfilter">AcceptFilter</a></code> directive.</p>
207
208     <p>You only need to set the protocol if you are running on non-standard
209        ports.  For example, running an <code>https</code> site on port 8443:</p>
210
211     <pre class="prettyprint lang-config">Listen 192.170.2.1:8443 https</pre>
212
213
214     <div class="note"><h3>Error condition</h3>
215       Multiple <code class="directive">Listen</code> directives for the same ip
216       address and port will result in an <code>Address already in use</code>
217       error message.
218     </div>
219
220
221 <h3>See also</h3>
222 <ul>
223 <li><a href="../dns-caveats.html">DNS Issues</a></li>
224 <li><a href="../bind.html">Setting which addresses and ports Apache HTTP Server
225     uses</a></li>
226 <li><a href="http://wiki.apache.org/httpd/CouldNotBindToAddress">Further
227 discussion of the <code>Address already in use</code> error message,
228 including other causes.</a></li>
229 </ul>
230 </div>
231 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
232 <div class="directive-section"><h2><a name="ListenBackLog" id="ListenBackLog">ListenBackLog</a> <a name="listenbacklog" id="listenbacklog">Directive</a></h2>
233 <table class="directive">
234 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum length of the queue of pending connections</td></tr>
235 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ListenBacklog <var>backlog</var></code></td></tr>
236 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ListenBacklog 511</code></td></tr>
237 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
238 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
239 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
240 </table>
241     <p>The maximum length of the queue of pending connections.
242     Generally no tuning is needed or desired, however on some
243     systems it is desirable to increase this when under a TCP SYN
244     flood attack. See the backlog parameter to the
245     <code>listen(2)</code> system call.</p>
246
247     <p>This will often be limited to a smaller number by the
248     operating system. This varies from OS to OS. Also note that
249     many OSes do not use exactly what is specified as the backlog,
250     but use a number based on (but normally larger than) what is
251     set.</p>
252
253 </div>
254 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
255 <div class="directive-section"><h2><a name="ListenCoresBucketsRatio" id="ListenCoresBucketsRatio">ListenCoresBucketsRatio</a> <a name="listencoresbucketsratio" id="listencoresbucketsratio">Directive</a></h2>
256 <table class="directive">
257 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Ratio between the number of CPU cores (online) and the number of
258 listeners' buckets</td></tr>
259 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ListenCoresBucketsRatio <var>ratio</var></code></td></tr>
260 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ListenCoresBucketsRatio 0 (disabled)</code></td></tr>
261 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
262 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
263 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
264 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.4.17, with a kernel supporting
265 the socket option <code>SO_REUSEPORT</code> and distributing new connections
266 evenly accross listening processes' (or threads') sockets using it (eg. Linux
267 3.9 and later, but not the current implementations of <code>SO_REUSEPORT</code>
268 in *BSDs.</td></tr>
269 </table>
270     <p>A <var>ratio</var> between the number of (online) CPU cores and the
271     number of listeners' buckets can be used to make Apache HTTP Server create
272     <code>num_cpu_cores / ratio</code> listening buckets, each containing its
273     own <code class="directive">Listen</code>-ing socket(s) on the same port(s), and
274     then make each child handle a single bucket (with round-robin distribution
275     of the buckets at children creation time).</p>
276
277     <p><code class="directive">ListenCoresBucketsRatio</code> can improve the
278     scalability when accepting new connections is/becomes the bottleneck.
279     On systems with a large number of CPU cores, enabling this feature has
280     been tested to show significant performances improvement and shorter
281     responses time.</p>
282
283     <p>There must be at least twice the number of CPU cores than the
284     configured <var>ratio</var> for this to be active. The recommended
285     <var>ratio</var> is <code>8</code>, hence at least <code>16</code>
286     cores should be available at runtime when this value is used.</p>
287
288 </div>
289 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
290 <div class="directive-section"><h2><a name="MaxConnectionsPerChild" id="MaxConnectionsPerChild">MaxConnectionsPerChild</a> <a name="maxconnectionsperchild" id="maxconnectionsperchild">Directive</a></h2>
291 <table class="directive">
292 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit on the number of connections that an individual child server
293 will handle during its life</td></tr>
294 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxConnectionsPerChild <var>number</var></code></td></tr>
295 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxConnectionsPerChild 0</code></td></tr>
296 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
297 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
298 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
299 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available Apache HTTP Server 2.3.9 and later. The old name
300 <code>MaxRequestsPerChild</code> is still supported.</td></tr>
301 </table>
302     <p>The <code class="directive">MaxConnectionsPerChild</code> directive sets
303     the limit on the number of connections that an individual child
304     server process will handle. After
305     <code class="directive">MaxConnectionsPerChild</code> connections, the child
306     process will die. If <code class="directive">MaxConnectionsPerChild</code> is
307     <code>0</code>, then the process will never expire.</p>
308
309     <p>Setting <code class="directive">MaxConnectionsPerChild</code> to a
310     non-zero value limits the amount of memory that process can consume
311     by (accidental) memory leakage.</p>
312
313 </div>
314 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
315 <div class="directive-section"><h2><a name="MaxMemFree" id="MaxMemFree">MaxMemFree</a> <a name="maxmemfree" id="maxmemfree">Directive</a></h2>
316 <table class="directive">
317 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum amount of memory that the main allocator is allowed
318 to hold without calling <code>free()</code></td></tr>
319 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxMemFree <var>KBytes</var></code></td></tr>
320 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxMemFree 2048</code></td></tr>
321 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
322 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
323 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code></td></tr>
324 </table>
325     <p>The <code class="directive">MaxMemFree</code> directive sets the
326     maximum number of free Kbytes that every allocator is allowed
327     to hold without calling <code>free()</code>. In threaded MPMs, every
328     thread has its own allocator. When set
329     to zero, the threshold will be set to unlimited.</p>
330
331 </div>
332 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
333 <div class="directive-section"><h2><a name="MaxRequestWorkers" id="MaxRequestWorkers">MaxRequestWorkers</a> <a name="maxrequestworkers" id="maxrequestworkers">Directive</a></h2>
334 <table class="directive">
335 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of connections that will be processed
336 simultaneously</td></tr>
337 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxRequestWorkers <var>number</var></code></td></tr>
338 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
339 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
340 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
341 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
342 </table>
343     <p>The <code class="directive">MaxRequestWorkers</code> directive sets the limit
344     on the number of simultaneous requests that will be served.  Any
345     connection attempts over the <code class="directive">MaxRequestWorkers</code>
346     limit will normally be queued, up to a number based on the
347     <code class="directive"><a href="#listenbacklog">ListenBacklog</a></code>
348     directive. Once a child process is freed at the end of a different
349     request, the connection will then be serviced.</p>
350
351     <p>For non-threaded servers (<em>i.e.</em>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>),
352     <code class="directive">MaxRequestWorkers</code> translates into the maximum
353     number of child processes that will be launched to serve requests.
354     The default value is <code>256</code>; to increase it, you must also raise
355     <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
356
357     <p>For threaded and hybrid servers (<em>e.g.</em> <code class="module"><a href="../mod/event.html">event</a></code>
358     or <code class="module"><a href="../mod/worker.html">worker</a></code>) <code class="directive">MaxRequestWorkers</code> restricts
359     the total number of threads that will be available to serve clients.
360     For hybrid MPMs the default value is <code>16</code> (<code class="directive"><a href="#serverlimit">ServerLimit</a></code>) multiplied by the value of
361     <code>25</code> (<code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>). Therefore, to increase <code class="directive">MaxRequestWorkers</code> to a value that requires more than 16 processes,
362     you must also raise <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
363
364     <p><code class="directive">MaxRequestWorkers</code> was called
365     <code class="directive">MaxClients</code> before version 2.3.13. The old name is still
366     supported.</p>
367
368 </div>
369 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
370 <div class="directive-section"><h2><a name="MaxSpareThreads" id="MaxSpareThreads">MaxSpareThreads</a> <a name="maxsparethreads" id="maxsparethreads">Directive</a></h2>
371 <table class="directive">
372 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of idle threads</td></tr>
373 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxSpareThreads <var>number</var></code></td></tr>
374 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
375 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
376 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
377 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
378 </table>
379     <p>Maximum number of idle threads. Different MPMs deal with this
380     directive differently.</p>
381
382     <p>For <code class="module"><a href="../mod/worker.html">worker</a></code> and <code class="module"><a href="../mod/event.html">event</a></code>, the default is
383     <code>MaxSpareThreads 250</code>. These MPMs deal with idle threads
384     on a server-wide basis. If there are too many idle threads in the
385     server then child processes are killed until the number of idle
386     threads is less than this number.</p>
387
388     <p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> the default is
389     <code>MaxSpareThreads 100</code>. Since this MPM runs a
390     single-process, the spare thread count is also server-wide.</p>
391
392     <p><code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> works
393     similar to <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>. For
394     <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>10</code>.</p>
395
396     <div class="note"><h3>Restrictions</h3>
397       <p>The range of the <code class="directive">MaxSpareThreads</code> value
398       is restricted. Apache httpd will correct the given value automatically
399       according to the following rules:</p>
400       <ul>
401         <li><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> wants the value to be greater than
402         <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>.</li>
403
404         <li>For <code class="module"><a href="../mod/worker.html">worker</a></code> and <code class="module"><a href="../mod/event.html">event</a></code>, the value
405         must be greater or equal to the sum of <code class="directive"><a href="#minsparethreads">
406         MinSpareThreads</a></code> and <code class="directive"><a href="#threadsperchild">
407         ThreadsPerChild</a></code>.</li>
408       </ul>
409     </div>
410
411 <h3>See also</h3>
412 <ul>
413 <li><code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code></li>
414 <li><code class="directive"><a href="#startservers">StartServers</a></code></li>
415 <li><code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code></li>
416 </ul>
417 </div>
418 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
419 <div class="directive-section"><h2><a name="MinSpareThreads" id="MinSpareThreads">MinSpareThreads</a> <a name="minsparethreads" id="minsparethreads">Directive</a></h2>
420 <table class="directive">
421 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Minimum number of idle threads available to handle request
422 spikes</td></tr>
423 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MinSpareThreads <var>number</var></code></td></tr>
424 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
425 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
426 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
427 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
428 </table>
429     <p>Minimum number of idle threads to handle request spikes.
430     Different MPMs deal with this directive differently.</p>
431
432     <p><code class="module"><a href="../mod/worker.html">worker</a></code> and <code class="module"><a href="../mod/event.html">event</a></code> use a default of
433     <code>MinSpareThreads 75</code> and deal with idle threads on a server-wide
434     basis. If there aren't enough idle threads in the server then child
435     processes are created until the number of idle threads is greater
436     than <var>number</var>.</p>
437
438     <p><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> uses a default of
439     <code>MinSpareThreads 10</code> and, since it is a single-process
440     MPM, tracks this on a server-wide bases.</p>
441
442     <p><code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> works
443     similar to <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>.  For
444     <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>5</code>.</p>
445
446 <h3>See also</h3>
447 <ul>
448 <li><code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code></li>
449 <li><code class="directive"><a href="#startservers">StartServers</a></code></li>
450 <li><code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code></li>
451 </ul>
452 </div>
453 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
454 <div class="directive-section"><h2><a name="PidFile" id="PidFile">PidFile</a> <a name="pidfile" id="pidfile">Directive</a></h2>
455 <table class="directive">
456 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File where the server records the process ID
457 of the daemon</td></tr>
458 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PidFile <var>filename</var></code></td></tr>
459 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>PidFile httpd.pid</code></td></tr>
460 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
461 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
462 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
463 </table>
464     <p>The <code class="directive">PidFile</code> directive sets the file to
465     which the server records the process id of the daemon. If the
466     filename is not absolute then it is assumed to be relative to the
467     <code class="directive"><a href="../mod/core.html#defaultruntimedir">DefaultRuntimeDir</a></code>.</p>
468
469     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">PidFile /var/run/apache.pid</pre>
470 </div>
471
472     <p>It is often useful to be able to send the server a signal,
473     so that it closes and then re-opens its <code class="directive"><a href="../mod/core.html#errorlog">ErrorLog</a></code> and <code class="directive"><a href="../mod/mod_log_config.html#transferlog">TransferLog</a></code>, and
474     re-reads its configuration files. This is done by sending a
475     SIGHUP (kill -1) signal to the process id listed in the
476     <code class="directive">PidFile</code>.</p>
477
478     <p>The <code class="directive">PidFile</code> is subject to the same
479     warnings about log file placement and <a href="../misc/security_tips.html#serverroot">security</a>.</p>
480
481     <div class="note"><h3>Note</h3>
482       <p>As of Apache HTTP Server 2, we recommended that you only use the <code class="program"><a href="../programs/apachectl.html">apachectl</a></code> script, or the init script that your OS provides,
483       for (re-)starting or stopping the server.</p>
484     </div>
485
486 </div>
487 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
488 <div class="directive-section"><h2><a name="ReceiveBufferSize" id="ReceiveBufferSize">ReceiveBufferSize</a> <a name="receivebuffersize" id="receivebuffersize">Directive</a></h2>
489 <table class="directive">
490 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>TCP receive buffer size</td></tr>
491 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ReceiveBufferSize <var>bytes</var></code></td></tr>
492 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ReceiveBufferSize 0</code></td></tr>
493 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
494 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
495 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
496 </table>
497     <p>The server will set the TCP receive buffer size to the number of
498     bytes specified.</p>
499
500     <p>If set to the value of <code>0</code>, the server will use the
501     OS default.</p>
502
503 </div>
504 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
505 <div class="directive-section"><h2><a name="ScoreBoardFile" id="ScoreBoardFile">ScoreBoardFile</a> <a name="scoreboardfile" id="scoreboardfile">Directive</a></h2>
506 <table class="directive">
507 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location of the file used to store coordination data for
508 the child processes</td></tr>
509 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScoreBoardFile <var>file-path</var></code></td></tr>
510 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScoreBoardFile apache_runtime_status</code></td></tr>
511 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
512 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
513 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr>
514 </table>
515     <p>Apache HTTP Server uses a scoreboard to communicate between its parent
516     and child processes.  Some architectures require a file to facilitate
517     this communication. If the file is left unspecified, Apache httpd first
518     attempts to create the scoreboard entirely in memory (using anonymous
519     shared memory) and, failing that, will attempt to create the file on
520     disk (using file-based shared memory). Specifying this directive causes
521     Apache httpd to always create the file on the disk.</p>
522
523     <p>If <var>file-path</var> is not an absolute path, the location specified
524     will be relative to the value of
525     <code class="directive"><a href="../mod/core.html#defaultruntimedir">DefaultRuntimeDir</a></code>.</p>
526
527     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">ScoreBoardFile /var/run/apache_runtime_status</pre>
528 </div>
529
530     <p>File-based shared memory is useful for third-party applications
531     that require direct access to the scoreboard.</p>
532
533     <p>If you use a <code class="directive">ScoreBoardFile</code> then
534     you may see improved speed by placing it on a RAM disk. But be
535     careful that you heed the same warnings about log file placement
536     and <a href="../misc/security_tips.html">security</a>.</p>
537
538 <h3>See also</h3>
539 <ul>
540 <li><a href="../stopping.html">Stopping and Restarting
541 Apache HTTP Server</a></li>
542 </ul>
543 </div>
544 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
545 <div class="directive-section"><h2><a name="SendBufferSize" id="SendBufferSize">SendBufferSize</a> <a name="sendbuffersize" id="sendbuffersize">Directive</a></h2>
546 <table class="directive">
547 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>TCP buffer size</td></tr>
548 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SendBufferSize <var>bytes</var></code></td></tr>
549 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SendBufferSize 0</code></td></tr>
550 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
551 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
552 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
553 </table>
554     <p>Sets the server's TCP send buffer size to the number of bytes
555     specified. It is often useful to set this past the OS's standard
556     default value on high speed, high latency connections
557     (<em>i.e.</em>, 100ms or so, such as transcontinental fast pipes).</p>
558
559     <p>If set to the value of <code>0</code>, the server will use the
560     default value provided by your OS.</p>
561
562     <p>Further configuration of your operating system may be required to elicit
563     better performance on high speed, high latency connections.</p>
564
565     <div class="note"> <p> On some operating systems, changes in TCP behavior resulting
566     from a larger <code class="directive">SendBufferSize</code> may not be seen unless
567     <code class="directive"><a href="../mod/core.html#enablesendfile">EnableSendfile</a></code> is set to OFF.  This
568     interaction applies only to static files.</p> </div>
569
570
571 </div>
572 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
573 <div class="directive-section"><h2><a name="ServerLimit" id="ServerLimit">ServerLimit</a> <a name="serverlimit" id="serverlimit">Directive</a></h2>
574 <table class="directive">
575 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Upper limit on configurable number of processes</td></tr>
576 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerLimit <var>number</var></code></td></tr>
577 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
578 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
579 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
580 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
581 </table>
582     <p>For the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM, this directive sets the
583     maximum configured value for <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> for the lifetime of the
584     Apache httpd process. For the <code class="module"><a href="../mod/worker.html">worker</a></code> and <code class="module"><a href="../mod/event.html">event
585     </a></code> MPMs, this directive in combination with <code class="directive"><a href="#threadlimit">ThreadLimit</a></code> sets
586     the maximum configured value for <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> for the lifetime of the
587     Apache httpd process. Any attempts to change this directive during a
588     restart will be ignored, but <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> can be modified during
589     a restart.</p>
590
591     <p>Special care must be taken when using this directive.  If
592     <code class="directive">ServerLimit</code> is set to a value much higher
593     than necessary, extra, unused shared memory will be allocated.  If
594     both <code class="directive">ServerLimit</code> and <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> are set to values
595     higher than the system can handle, Apache httpd may not start or the
596     system may become unstable.</p>
597
598     <p>With the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM, use this directive only
599     if you need to set <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> higher than 256 (default).
600     Do not set the value of this directive any higher than what you
601     might want to set <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> to.</p>
602
603     <p>With <code class="module"><a href="../mod/worker.html">worker</a></code> and <code class="module"><a href="../mod/event.html">event</a></code>, use this
604     directive only if your <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers
605     </a></code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>
606     settings require more than 16 server processes (default). Do not set
607     the value of this directive any higher than the number of server
608     processes required by what you may want for <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers </a></code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>.</p>
609
610     <div class="note"><h3>Note</h3>
611       <p>There is a hard limit of <code>ServerLimit 20000</code> compiled
612       into the server (for the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM 200000). This is
613       intended to avoid nasty effects caused by typos. To increase it
614       even further past this limit, you will need to modify the value of
615       MAX_SERVER_LIMIT in the mpm source file and rebuild the server.</p>
616     </div>
617
618 <h3>See also</h3>
619 <ul>
620 <li><a href="../stopping.html">Stopping and Restarting Apache HTTP Server</a></li>
621 </ul>
622 </div>
623 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
624 <div class="directive-section"><h2><a name="StartServers" id="StartServers">StartServers</a> <a name="startservers" id="startservers">Directive</a></h2>
625 <table class="directive">
626 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of child server processes created at startup</td></tr>
627 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>StartServers <var>number</var></code></td></tr>
628 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
629 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
630 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
631 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
632 </table>
633     <p>The <code class="directive">StartServers</code> directive sets the
634     number of child server processes created on startup. As the number
635     of processes is dynamically controlled depending on the load, (see
636     <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>,
637     <code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code>,
638     <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>, <code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code>)
639     there is usually little reason to adjust this parameter.</p>
640
641     <p>The default value differs from MPM to MPM. <code class="module"><a href="../mod/worker.html">worker</a></code> and
642     <code class="module"><a href="../mod/event.html">event</a></code> default to <code>StartServers 3</code>; <code class="module"><a href="../mod/prefork.html">
643     prefork</a></code> defaults to <code>5</code>; <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>
644     defaults to <code>2</code>.</p>
645
646 </div>
647 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
648 <div class="directive-section"><h2><a name="StartThreads" id="StartThreads">StartThreads</a> <a name="startthreads" id="startthreads">Directive</a></h2>
649 <table class="directive">
650 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of threads created on startup</td></tr>
651 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>StartThreads <var>number</var></code></td></tr>
652 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
653 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
654 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
655 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code></td></tr>
656 </table>
657     <p>Number of threads created on startup. As the
658     number of threads is dynamically controlled depending on the
659     load, (see
660     <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>,
661     <code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code>,
662     <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>, <code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code>)
663     there is usually little reason to adjust this
664     parameter.</p>
665
666     <p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> the default is
667     <code>StartThreads 50</code> and, since there is only a single
668     process, this is the total number of threads created at startup to
669     serve requests.</p>
670
671 </div>
672 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
673 <div class="directive-section"><h2><a name="ThreadLimit" id="ThreadLimit">ThreadLimit</a> <a name="threadlimit" id="threadlimit">Directive</a></h2>
674 <table class="directive">
675 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the upper limit on the configurable number of threads
676 per child process</td></tr>
677 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadLimit <var>number</var></code></td></tr>
678 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
679 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
680 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
681 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr>
682 </table>
683     <p>This directive sets the maximum configured value for <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the lifetime
684     of the Apache httpd process.  Any attempts to change this directive
685     during a restart will be ignored, but <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> can be modified
686     during a restart up to the value of this directive.</p>
687
688     <p>Special care must be taken when using this directive.  If
689     <code class="directive">ThreadLimit</code> is set to a value much higher
690     than <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>,
691     extra unused shared memory will be allocated.  If both
692     <code class="directive">ThreadLimit</code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> are set to values
693     higher than the system can handle, Apache httpd may not start or the
694     system may become unstable. Do not set the value of this directive
695     any higher than your greatest predicted setting of <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the
696     current run of Apache httpd.</p>
697
698     <p>The default value for <code class="directive">ThreadLimit</code> is
699     <code>1920</code> when used with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> and
700     <code>64</code> when used with the others.</p>
701
702     <div class="note"><h3>Note</h3>
703       <p>There is a hard limit of <code>ThreadLimit 20000</code> (or
704       <code>ThreadLimit 100000</code> with <code class="module"><a href="../mod/event.html">event</a></code>,
705       <code>ThreadLimit 15000</code> with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>)
706       compiled into the server. This is intended to avoid nasty effects
707       caused by typos. To increase it even further past this limit, you
708       will need to modify the value of MAX_THREAD_LIMIT in the mpm
709       source file and rebuild the server.</p>
710     </div>
711
712 </div>
713 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
714 <div class="directive-section"><h2><a name="ThreadsPerChild" id="ThreadsPerChild">ThreadsPerChild</a> <a name="threadsperchild" id="threadsperchild">Directive</a></h2>
715 <table class="directive">
716 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of threads created by each child process</td></tr>
717 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadsPerChild <var>number</var></code></td></tr>
718 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
719 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
720 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
721 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr>
722 </table>
723     <p>This directive sets the number of threads created by each
724     child process. The child creates these threads at startup and
725     never creates more. If using an MPM like <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>,
726     where there is only one child process, this number should be high
727     enough to handle the entire load of the server. If using an MPM
728     like <code class="module"><a href="../mod/worker.html">worker</a></code>, where there are multiple child processes,
729     the <em>total</em> number of threads should be high enough to handle
730     the common load on the server.</p>
731
732     <p>The default value for <code class="directive">ThreadsPerChild</code> is
733     <code>64</code> when used with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> and
734     <code>25</code> when used with the others.</p>
735
736 </div>
737 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
738 <div class="directive-section"><h2><a name="ThreadStackSize" id="ThreadStackSize">ThreadStackSize</a> <a name="threadstacksize" id="threadstacksize">Directive</a></h2>
739 <table class="directive">
740 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The size in bytes of the stack used by threads handling
741 client connections</td></tr>
742 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadStackSize <var>size</var></code></td></tr>
743 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>65536 on NetWare; varies on other operating systems</code></td></tr>
744 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
745 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
746 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
747 </table>
748     <p>The <code class="directive">ThreadStackSize</code> directive sets the
749     size of the stack (for autodata) of threads which handle client
750     connections and call modules to help process those connections.
751     In most cases the operating system default for stack size is
752     reasonable, but there are some conditions where it may need to be
753     adjusted:</p>
754
755     <ul>
756       <li>On platforms with a relatively small default thread stack size
757       (e.g., HP-UX), Apache httpd may crash when using some third-party modules
758       which use a relatively large amount of autodata storage.  Those
759       same modules may have worked fine on other platforms where the
760       default thread stack size is larger.  This type of crash is
761       resolved by setting <code class="directive">ThreadStackSize</code> to a
762       value higher than the operating system default.  This type of
763       adjustment is necessary only if the provider of the third-party
764       module specifies that it is required, or if diagnosis of an Apache httpd
765       crash indicates that the thread stack size was too small.</li>
766
767       <li>On platforms where the default thread stack size is
768       significantly larger than necessary for the web server
769       configuration, a higher number of threads per child process
770       will be achievable if <code class="directive">ThreadStackSize</code> is
771       set to a value lower than the operating system default.  This type
772       of adjustment should only be made in a test environment which allows
773       the full set of web server processing can be exercised, as there
774       may be infrequent requests which require more stack to process.
775       The minimum required stack size strongly depends on the modules
776       used, but any change in the web server configuration can invalidate
777       the current <code class="directive">ThreadStackSize</code> setting.</li>
778
779       <li>On Linux, this directive can only be used to increase the default
780       stack size, as the underlying system call uses the value as a
781       <em>minimum</em> stack size.  The (often large) soft limit for
782       <code>ulimit -s</code> (8MB if unlimited) is used as the default stack
783       size.</li>
784     </ul>
785
786     <div class="note">It is recommended to not reduce <code class="directive">ThreadStackSize</code>
787     unless a high number of threads per child process is needed. On some
788     platforms (including Linux), a setting of 128000 is already too low and
789     causes crashes with some common modules.</div>
790
791 </div>
792 </div>
793 <div class="bottomlang">
794 <p><span>Available Languages: </span><a href="../de/mod/mpm_common.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
795 <a href="../en/mod/mpm_common.html" title="English">&nbsp;en&nbsp;</a> |
796 <a href="../ja/mod/mpm_common.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
797 <a href="../tr/mod/mpm_common.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
798 </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
799 <script type="text/javascript"><!--//--><![CDATA[//><!--
800 var comments_shortname = 'httpd';
801 var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mpm_common.html';
802 (function(w, d) {
803     if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
804         d.write('<div id="comments_thread"><\/div>');
805         var s = d.createElement('script');
806         s.type = 'text/javascript';
807         s.async = true;
808         s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
809         (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
810     }
811     else {
812         d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
813     }
814 })(window, document);
815 //--><!]]></script></div><div id="footer">
816 <p class="apache">Copyright 2015 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
817 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
818 if (typeof(prettyPrint) !== 'undefined') {
819     prettyPrint();
820 }
821 //--><!]]></script>
822 </body></html>