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 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 This file is generated from xml source: DO NOT EDIT
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8 <title>mpm_common - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <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" />
12 <script src="../style/scripts/prettify.js" type="text/javascript">
15 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
17 <div id="page-header">
18 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.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>
19 <p class="apache">Apache HTTP Server Version 2.5</p>
20 <img alt="" src="../images/feather.gif" /></div>
21 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
23 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.5</a> > <a href="./">Modules</a></div>
24 <div id="page-content">
25 <div id="preamble"><h1>Apache MPM Common Directives</h1>
27 <p><span>Available Languages: </span><a href="../de/mod/mpm_common.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
28 <a href="../en/mod/mpm_common.html" title="English"> en </a> |
29 <a href="../ja/mod/mpm_common.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
30 <a href="../tr/mod/mpm_common.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
32 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>A collection of directives that are implemented by
33 more than one multi-processing module (MPM)</td></tr>
34 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>MPM</td></tr></table>
36 <div id="quickview"><h3 class="directives">Directives</h3>
38 <li><img alt="" src="../images/down.gif" /> <a href="#coredumpdirectory">CoreDumpDirectory</a></li>
39 <li><img alt="" src="../images/down.gif" /> <a href="#enableexceptionhook">EnableExceptionHook</a></li>
40 <li><img alt="" src="../images/down.gif" /> <a href="#gracefulshutdowntimeout">GracefulShutdownTimeout</a></li>
41 <li><img alt="" src="../images/down.gif" /> <a href="#listen">Listen</a></li>
42 <li><img alt="" src="../images/down.gif" /> <a href="#listenbacklog">ListenBackLog</a></li>
43 <li><img alt="" src="../images/down.gif" /> <a href="#maxconnectionsperchild">MaxConnectionsPerChild</a></li>
44 <li><img alt="" src="../images/down.gif" /> <a href="#maxmemfree">MaxMemFree</a></li>
45 <li><img alt="" src="../images/down.gif" /> <a href="#maxrequestworkers">MaxRequestWorkers</a></li>
46 <li><img alt="" src="../images/down.gif" /> <a href="#maxsparethreads">MaxSpareThreads</a></li>
47 <li><img alt="" src="../images/down.gif" /> <a href="#minsparethreads">MinSpareThreads</a></li>
48 <li><img alt="" src="../images/down.gif" /> <a href="#pidfile">PidFile</a></li>
49 <li><img alt="" src="../images/down.gif" /> <a href="#receivebuffersize">ReceiveBufferSize</a></li>
50 <li><img alt="" src="../images/down.gif" /> <a href="#scoreboardfile">ScoreBoardFile</a></li>
51 <li><img alt="" src="../images/down.gif" /> <a href="#sendbuffersize">SendBufferSize</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#serverlimit">ServerLimit</a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#startservers">StartServers</a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#startthreads">StartThreads</a></li>
55 <li><img alt="" src="../images/down.gif" /> <a href="#threadlimit">ThreadLimit</a></li>
56 <li><img alt="" src="../images/down.gif" /> <a href="#threadsperchild">ThreadsPerChild</a></li>
57 <li><img alt="" src="../images/down.gif" /> <a href="#threadstacksize">ThreadStackSize</a></li>
59 <ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
61 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
62 <div class="directive-section"><h2><a name="CoreDumpDirectory" id="CoreDumpDirectory">CoreDumpDirectory</a> <a name="coredumpdirectory" id="coredumpdirectory">Directive</a></h2>
63 <table class="directive">
64 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory where Apache HTTP Server attempts to
65 switch before dumping core</td></tr>
66 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CoreDumpDirectory <var>directory</var></code></td></tr>
67 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for the default setting</code></td></tr>
68 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
69 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
70 <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/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
72 <p>This controls the directory to which Apache httpd attempts to
73 switch before dumping core. If your operating system is configured to
74 create core files in the working directory of the crashing process,
75 <code class="directive">CoreDumpDirectory</code> is necessary to change working
76 directory from the default <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>
77 directory, which should not be writable by the user the server runs as.</p>
79 <p>If you want a core dump for debugging, you can use this directive to
80 place it in a different location. This directive has no effect if your
81 operating system is not configured to write core files to the working directory
82 of the crashing processes.</p>
84 <div class="note"><h3>Core Dumps on Linux</h3>
85 <p>If Apache httpd starts as root and switches to another user, the
86 Linux kernel <em>disables</em> core dumps even if the directory is
87 writable for the process. Apache httpd (2.0.46 and later) reenables core dumps
88 on Linux 2.4 and beyond, but only if you explicitly configure a <code class="directive">CoreDumpDirectory</code>.</p>
92 <h3>Core Dumps on BSD</h3>
93 <p>To enable core-dumping of suid-executables on BSD-systems (such
94 as FreeBSD), set <code>kern.sugid_coredump</code> to 1.
98 <div class="note"><h3>Specific signals</h3>
99 <p><code class="directive">CoreDumpDirectory</code> processing only occurs for
100 a select set of fatal signals: SIGFPE, SIGILL, SIGABORT,
101 SIGSEGV, and SIGBUS.</p>
102 <p>On some operating systems, SIGQUIT also results in a core dump but
103 does not go through <code class="directive">CoreDumpDirectory</code> or
104 <code class="directive">EnableExceptionHook</code> processing, so the core
105 location is dictated entirely by the operating system.</p>
110 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
111 <div class="directive-section"><h2><a name="EnableExceptionHook" id="EnableExceptionHook">EnableExceptionHook</a> <a name="enableexceptionhook" id="enableexceptionhook">Directive</a></h2>
112 <table class="directive">
113 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables a hook that runs exception handlers
114 after a crash</td></tr>
115 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableExceptionHook On|Off</code></td></tr>
116 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableExceptionHook Off</code></td></tr>
117 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
118 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
119 <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/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
120 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.49 and later</td></tr>
122 <p>For safety reasons this directive is only available if the server was
123 configured with the <code>--enable-exception-hook</code> option. It
124 enables a hook that allows external modules to plug in and do something
125 after a child crashed.</p>
127 <p>There are already two modules, <code>mod_whatkilledus</code> and
128 <code>mod_backtrace</code> that make use of this hook. Please have a
129 look at Jeff Trawick's <a href="http://www.apache.org/~trawick/exception_hook.html">EnableExceptionHook site</a> for more information about these.</p>
132 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
133 <div class="directive-section"><h2><a name="GracefulShutdownTimeout" id="GracefulShutdownTimeout">GracefulShutdownTimeout</a> <a name="gracefulshutdowntimeout" id="gracefulshutdowntimeout">Directive</a></h2>
134 <table class="directive">
135 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify a timeout after which a gracefully shutdown server
137 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>GracefulShutDownTimeout <var>seconds</var></code></td></tr>
138 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>GracefulShutDownTimeout 0</code></td></tr>
139 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
140 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
141 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/event.html">event</a></code></td></tr>
142 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.2 and later</td></tr>
144 <p>The <code class="directive">GracefulShutdownTimeout</code> specifies
145 how many seconds after receiving a "graceful-stop" signal, a
146 server should continue to run, handling the existing connections.</p>
148 <p>Setting this value to zero means that the server will wait
149 indefinitely until all remaining requests have been fully served.</p>
152 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
153 <div class="directive-section"><h2><a name="Listen" id="Listen">Listen</a> <a name="listen" id="listen">Directive</a></h2>
154 <table class="directive">
155 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>IP addresses and ports that the server
157 <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>
158 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
159 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
160 <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>, <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>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/event.html">event</a></code></td></tr>
161 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Required directive since Apache HTTP Server 2.0<br />
162 The <var>protocol</var> argument was added in 2.1.5</td></tr>
164 <p>The <code class="directive">Listen</code> directive instructs Apache httpd to
165 listen to only specific IP addresses or ports; by default it
166 responds to requests on all IP interfaces. <code class="directive">Listen</code>
167 is now a required directive. If it is not in the config file, the
168 server will fail to start. This is a change from previous versions
171 <p>The <code class="directive">Listen</code> directive tells the server to
172 accept incoming requests on the specified port or address-and-port
173 combination. If only a port number is specified, the server listens to
174 the given port on all interfaces. If an IP address is given as well
175 as a port, the server will listen on the given port and
178 <p>Multiple <code class="directive">Listen</code> directives may be used to
179 specify a number of addresses and ports to listen to. The server will
180 respond to requests from any of the listed addresses and ports.</p>
182 <p>For example, to make the server accept connections on both
183 port 80 and port 8000, use:</p>
185 <pre class="prettyprint lang-config">
191 <p>To make the server accept connections on two specified
192 interfaces and port numbers, use </p>
194 <pre class="prettyprint lang-config">
195 Listen 192.170.2.1:80
196 Listen 192.170.2.5:8000
200 <p>IPv6 addresses must be surrounded in square brackets, as in the
201 following example:</p>
203 <pre class="prettyprint lang-config">
204 Listen [2001:db8::a00:20ff:fea7:ccea]:80
208 <p>The optional <var>protocol</var> argument is not required for most
209 configurations. If not specified, <code>https</code> is the default for
210 port 443 and <code>http</code> the default for all other ports. The
211 protocol is used to determine which module should handle a request, and
212 to apply protocol specific optimizations with the
213 <code class="directive"><a href="../mod/core.html#acceptfilter">AcceptFilter</a></code> directive.</p>
215 <p>You only need to set the protocol if you are running on non-standard
216 ports. For example, running an <code>https</code> site on port 8443:</p>
218 <pre class="prettyprint lang-config">
219 Listen 192.170.2.1:8443 https
223 <div class="note"><h3>Error condition</h3>
224 Multiple <code class="directive">Listen</code> directives for the same ip
225 address and port will result in an <code>Address already in use</code>
232 <li><a href="../dns-caveats.html">DNS Issues</a></li>
233 <li><a href="../bind.html">Setting which addresses and ports Apache HTTP Server
235 <li><a href="http://wiki.apache.org/httpd/CouldNotBindToAddress">Further
236 discussion of the <code>Address already in use</code> error message,
237 including other causes.</a></li>
240 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
241 <div class="directive-section"><h2><a name="ListenBackLog" id="ListenBackLog">ListenBackLog</a> <a name="listenbacklog" id="listenbacklog">Directive</a></h2>
242 <table class="directive">
243 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum length of the queue of pending connections</td></tr>
244 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ListenBacklog <var>backlog</var></code></td></tr>
245 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ListenBacklog 511</code></td></tr>
246 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
247 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
248 <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/mpm_netware.html">mpm_netware</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>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
250 <p>The maximum length of the queue of pending connections.
251 Generally no tuning is needed or desired, however on some
252 systems it is desirable to increase this when under a TCP SYN
253 flood attack. See the backlog parameter to the
254 <code>listen(2)</code> system call.</p>
256 <p>This will often be limited to a smaller number by the
257 operating system. This varies from OS to OS. Also note that
258 many OSes do not use exactly what is specified as the backlog,
259 but use a number based on (but normally larger than) what is
263 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
264 <div class="directive-section"><h2><a name="MaxConnectionsPerChild" id="MaxConnectionsPerChild">MaxConnectionsPerChild</a> <a name="maxconnectionsperchild" id="maxconnectionsperchild">Directive</a></h2>
265 <table class="directive">
266 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit on the number of connections that an individual child server
267 will handle during its life</td></tr>
268 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxConnectionsPerChild <var>number</var></code></td></tr>
269 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxConnectionsPerChild 0</code></td></tr>
270 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
271 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
272 <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/mpm_netware.html">mpm_netware</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>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
273 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available Apache HTTP Server 2.3.9 and later. The old name
274 <code>MaxRequestsPerChild</code> is still supported.</td></tr>
276 <p>The <code class="directive">MaxConnectionsPerChild</code> directive sets
277 the limit on the number of connections that an individual child
278 server process will handle. After
279 <code class="directive">MaxConnectionsPerChild</code> connections, the child
280 process will die. If <code class="directive">MaxConnectionsPerChild</code> is
281 <code>0</code>, then the process will never expire.</p>
283 <p>Setting <code class="directive">MaxConnectionsPerChild</code> to a
284 non-zero value limits the amount of memory that process can consume
285 by (accidental) memory leakage.</p>
288 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
289 <div class="directive-section"><h2><a name="MaxMemFree" id="MaxMemFree">MaxMemFree</a> <a name="maxmemfree" id="maxmemfree">Directive</a></h2>
290 <table class="directive">
291 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum amount of memory that the main allocator is allowed
292 to hold without calling <code>free()</code></td></tr>
293 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxMemFree <var>KBytes</var></code></td></tr>
294 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxMemFree 2048</code></td></tr>
295 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
296 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
297 <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/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</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>
299 <p>The <code class="directive">MaxMemFree</code> directive sets the
300 maximum number of free Kbytes that every allocator is allowed
301 to hold without calling <code>free()</code>. In threaded MPMs, every
302 thread has its own allocator. When set
303 to zero, the threshold will be set to unlimited.</p>
306 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
307 <div class="directive-section"><h2><a name="MaxRequestWorkers" id="MaxRequestWorkers">MaxRequestWorkers</a> <a name="maxrequestworkers" id="maxrequestworkers">Directive</a></h2>
308 <table class="directive">
309 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of connections that will be processed
310 simultaneously</td></tr>
311 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxRequestWorkers <var>number</var></code></td></tr>
312 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
313 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
314 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
315 <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/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
317 <p>The <code class="directive">MaxRequestWorkers</code> directive sets the limit
318 on the number of simultaneous requests that will be served. Any
319 connection attempts over the <code class="directive">MaxRequestWorkers</code>
320 limit will normally be queued, up to a number based on the
321 <code class="directive"><a href="#listenbacklog">ListenBacklog</a></code>
322 directive. Once a child process is freed at the end of a different
323 request, the connection will then be serviced.</p>
325 <p>For non-threaded servers (<em>i.e.</em>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>),
326 <code class="directive">MaxRequestWorkers</code> translates into the maximum
327 number of child processes that will be launched to serve requests.
328 The default value is <code>256</code>; to increase it, you must also raise
329 <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
331 <p>For threaded and hybrid servers (<em>e.g.</em> <code class="module"><a href="../mod/event.html">event</a></code>
332 or <code class="module"><a href="../mod/worker.html">worker</a></code>) <code class="directive">MaxRequestWorkers</code> restricts
333 the total number of threads that will be available to serve clients.
334 For hybrid MPMs the default value is <code>16</code> (<code class="directive"><a href="#serverlimit">ServerLimit</a></code>) multiplied by the value of
335 <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,
336 you must also raise <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
338 <p><code class="directive">MaxRequestWorkers</code> was called
339 <code class="directive">MaxClients</code> before version 2.3.13. The old name is still
343 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
344 <div class="directive-section"><h2><a name="MaxSpareThreads" id="MaxSpareThreads">MaxSpareThreads</a> <a name="maxsparethreads" id="maxsparethreads">Directive</a></h2>
345 <table class="directive">
346 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of idle threads</td></tr>
347 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxSpareThreads <var>number</var></code></td></tr>
348 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
349 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
350 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
351 <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/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
353 <p>Maximum number of idle threads. Different MPMs deal with this
354 directive differently.</p>
356 <p>For <code class="module"><a href="../mod/worker.html">worker</a></code>, the default is
357 <code>MaxSpareThreads 250</code>. This MPM deals with idle threads
358 on a server-wide basis. If there are too many idle threads in the
359 server then child processes are killed until the number of idle
360 threads is less than this number.</p>
362 <p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> the default is
363 <code>MaxSpareThreads 100</code>. Since this MPM runs a
364 single-process, the spare thread count is also server-wide.</p>
366 <p><code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> works
367 similar to <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>. For
368 <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>10</code>.</p>
370 <div class="note"><h3>Restrictions</h3>
371 <p>The range of the <code class="directive">MaxSpareThreads</code> value
372 is restricted. Apache httpd will correct the given value automatically
373 according to the following rules:</p>
375 <li><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> wants the value to be greater than
376 <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>.</li>
378 <li>For <code class="module"><a href="../mod/worker.html">worker</a></code>, the value must be greater or equal
379 to the sum of <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>
380 and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>.</li>
386 <li><code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code></li>
387 <li><code class="directive"><a href="#startservers">StartServers</a></code></li>
388 <li><code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code></li>
391 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
392 <div class="directive-section"><h2><a name="MinSpareThreads" id="MinSpareThreads">MinSpareThreads</a> <a name="minsparethreads" id="minsparethreads">Directive</a></h2>
393 <table class="directive">
394 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Minimum number of idle threads available to handle request
396 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MinSpareThreads <var>number</var></code></td></tr>
397 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
398 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
399 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
400 <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/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
402 <p>Minimum number of idle threads to handle request spikes.
403 Different MPMs deal with this directive
406 <p><code class="module"><a href="../mod/worker.html">worker</a></code> uses a default of <code>MinSpareThreads
407 75</code> and deals with idle threads on a server-wide basis. If
408 there aren't enough idle threads in the server then child
409 processes are created until the number of idle threads is greater
410 than <var>number</var>.</p>
412 <p><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> uses a default of
413 <code>MinSpareThreads 10</code> and, since it is a single-process
414 MPM, tracks this on a server-wide bases.</p>
416 <p><code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> works
417 similar to <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>. For
418 <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>5</code>.</p>
422 <li><code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code></li>
423 <li><code class="directive"><a href="#startservers">StartServers</a></code></li>
424 <li><code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code></li>
427 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
428 <div class="directive-section"><h2><a name="PidFile" id="PidFile">PidFile</a> <a name="pidfile" id="pidfile">Directive</a></h2>
429 <table class="directive">
430 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File where the server records the process ID
431 of the daemon</td></tr>
432 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PidFile <var>filename</var></code></td></tr>
433 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>PidFile logs/httpd.pid</code></td></tr>
434 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
435 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
436 <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/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
438 <p>The <code class="directive">PidFile</code> directive sets the file to
439 which the server records the process id of the daemon. If the
440 filename is not absolute then it is assumed to be relative to the
441 <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>.</p>
443 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
444 PidFile /var/run/apache.pid
448 <p>It is often useful to be able to send the server a signal,
449 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
450 re-reads its configuration files. This is done by sending a
451 SIGHUP (kill -1) signal to the process id listed in the
452 <code class="directive">PidFile</code>.</p>
454 <p>The <code class="directive">PidFile</code> is subject to the same
455 warnings about log file placement and <a href="../misc/security_tips.html#serverroot">security</a>.</p>
457 <div class="note"><h3>Note</h3>
458 <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,
459 for (re-)starting or stopping the server.</p>
463 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
464 <div class="directive-section"><h2><a name="ReceiveBufferSize" id="ReceiveBufferSize">ReceiveBufferSize</a> <a name="receivebuffersize" id="receivebuffersize">Directive</a></h2>
465 <table class="directive">
466 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>TCP receive buffer size</td></tr>
467 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ReceiveBufferSize <var>bytes</var></code></td></tr>
468 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ReceiveBufferSize 0</code></td></tr>
469 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
470 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
471 <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/mpm_netware.html">mpm_netware</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>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
473 <p>The server will set the TCP receive buffer size to the number of
476 <p>If set to the value of <code>0</code>, the server will use the
480 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
481 <div class="directive-section"><h2><a name="ScoreBoardFile" id="ScoreBoardFile">ScoreBoardFile</a> <a name="scoreboardfile" id="scoreboardfile">Directive</a></h2>
482 <table class="directive">
483 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location of the file used to store coordination data for
484 the child processes</td></tr>
485 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScoreBoardFile <var>file-path</var></code></td></tr>
486 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScoreBoardFile logs/apache_status</code></td></tr>
487 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
488 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
489 <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/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
491 <p>Apache HTTP Server uses a scoreboard to communicate between its parent
492 and child processes. Some architectures require a file to facilitate
493 this communication. If the file is left unspecified, Apache httpd first
494 attempts to create the scoreboard entirely in memory (using anonymous
495 shared memory) and, failing that, will attempt to create the file on
496 disk (using file-based shared memory). Specifying this directive causes
497 Apache httpd to always create the file on the disk.</p>
499 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
500 ScoreBoardFile /var/run/apache_status
504 <p>File-based shared memory is useful for third-party applications
505 that require direct access to the scoreboard.</p>
507 <p>If you use a <code class="directive">ScoreBoardFile</code> then
508 you may see improved speed by placing it on a RAM disk. But be
509 careful that you heed the same warnings about log file placement
510 and <a href="../misc/security_tips.html">security</a>.</p>
514 <li><a href="../stopping.html">Stopping and Restarting
515 Apache HTTP Server</a></li>
518 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
519 <div class="directive-section"><h2><a name="SendBufferSize" id="SendBufferSize">SendBufferSize</a> <a name="sendbuffersize" id="sendbuffersize">Directive</a></h2>
520 <table class="directive">
521 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>TCP buffer size</td></tr>
522 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SendBufferSize <var>bytes</var></code></td></tr>
523 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SendBufferSize 0</code></td></tr>
524 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
525 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
526 <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/mpm_netware.html">mpm_netware</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>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
528 <p>Sets the server's TCP send buffer size to the number of bytes
529 specified. It is often useful to set this past the OS's standard
530 default value on high speed, high latency connections
531 (<em>i.e.</em>, 100ms or so, such as transcontinental fast pipes).</p>
533 <p>If set to the value of <code>0</code>, the server will use the
534 default value provided by your OS.</p>
536 <p>Further configuration of your operating system may be required to elicit
537 better performance on high speed, high latency connections.</p>
539 <div class="note"> <p> On some operating systems, changes in TCP behavior resulting
540 from a larger <code class="directive">SendBufferSize</code> may not be seen unless
541 <code class="directive"><a href="../mod/core.html#enablesendfile">EnableSendfile</a></code> is set to OFF. This
542 interaction applies only to static files.</p> </div>
546 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
547 <div class="directive-section"><h2><a name="ServerLimit" id="ServerLimit">ServerLimit</a> <a name="serverlimit" id="serverlimit">Directive</a></h2>
548 <table class="directive">
549 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Upper limit on configurable number of processes</td></tr>
550 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerLimit <var>number</var></code></td></tr>
551 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
552 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
553 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
554 <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/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
556 <p>For the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM, this directive sets the
557 maximum configured value for <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> for the lifetime of the
558 Apache httpd process. For the <code class="module"><a href="../mod/worker.html">worker</a></code> MPM, this directive
559 in combination with <code class="directive"><a href="#threadlimit">ThreadLimit</a></code> sets
560 the maximum configured value for <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> for the lifetime of the
561 Apache httpd process. Any attempts to change this directive during a
562 restart will be ignored, but <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> can be modified during
565 <p>Special care must be taken when using this directive. If
566 <code class="directive">ServerLimit</code> is set to a value much higher
567 than necessary, extra, unused shared memory will be allocated. If
568 both <code class="directive">ServerLimit</code> and <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> are set to values
569 higher than the system can handle, Apache httpd may not start or the
570 system may become unstable.</p>
572 <p>With the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM, use this directive only
573 if you need to set <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> higher than 256 (default).
574 Do not set the value of this directive any higher than what you
575 might want to set <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> to.</p>
577 <p>With <code class="module"><a href="../mod/worker.html">worker</a></code>, use this directive only
578 if your <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> and
579 <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>
580 settings require more than 16 server processes (default). Do not set
581 the value of this directive any higher than the number of server
582 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>
584 <div class="note"><h3>Note</h3>
585 <p>There is a hard limit of <code>ServerLimit 20000</code> compiled
586 into the server (for the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM 200000). This is
587 intended to avoid nasty effects caused by typos. To increase it
588 even further past this limit, you will need to modify the value of
589 MAX_SERVER_LIMIT in the mpm source file and rebuild the server.</p>
594 <li><a href="../stopping.html">Stopping and Restarting Apache HTTP Server</a></li>
597 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
598 <div class="directive-section"><h2><a name="StartServers" id="StartServers">StartServers</a> <a name="startservers" id="startservers">Directive</a></h2>
599 <table class="directive">
600 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of child server processes created at startup</td></tr>
601 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>StartServers <var>number</var></code></td></tr>
602 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
603 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
604 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
605 <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/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
607 <p>The <code class="directive">StartServers</code> directive sets the
608 number of child server processes created on startup. As the number
609 of processes is dynamically controlled depending on the load, (see
610 <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>,
611 <code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code>,
612 <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>, <code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code>)
613 there is usually little reason to adjust this parameter.</p>
615 <p>The default value differs from MPM to MPM. <code class="module"><a href="../mod/worker.html">worker</a></code>
616 defaults to <code>StartServers 3</code>; <code class="module"><a href="../mod/prefork.html">prefork</a></code>
617 defaults to <code>5</code>; <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> defaults to
621 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
622 <div class="directive-section"><h2><a name="StartThreads" id="StartThreads">StartThreads</a> <a name="startthreads" id="startthreads">Directive</a></h2>
623 <table class="directive">
624 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of threads created on startup</td></tr>
625 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>StartThreads <var>number</var></code></td></tr>
626 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
627 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
628 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
629 <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>
631 <p>Number of threads created on startup. As the
632 number of threads is dynamically controlled depending on the
634 <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>,
635 <code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code>,
636 <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>, <code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code>)
637 there is usually little reason to adjust this
640 <p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> the default is
641 <code>StartThreads 50</code> and, since there is only a single
642 process, this is the total number of threads created at startup to
646 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
647 <div class="directive-section"><h2><a name="ThreadLimit" id="ThreadLimit">ThreadLimit</a> <a name="threadlimit" id="threadlimit">Directive</a></h2>
648 <table class="directive">
649 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the upper limit on the configurable number of threads
650 per child process</td></tr>
651 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadLimit <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/event.html">event</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
656 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available for <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> in Apache HTTP Server 2.0.41
659 <p>This directive sets the maximum configured value for <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the lifetime
660 of the Apache httpd process. Any attempts to change this directive
661 during a restart will be ignored, but <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> can be modified
662 during a restart up to the value of this directive.</p>
664 <p>Special care must be taken when using this directive. If
665 <code class="directive">ThreadLimit</code> is set to a value much higher
666 than <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>,
667 extra unused shared memory will be allocated. If both
668 <code class="directive">ThreadLimit</code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> are set to values
669 higher than the system can handle, Apache httpd may not start or the
670 system may become unstable. Do not set the value of this directive
671 any higher than your greatest predicted setting of <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the
672 current run of Apache httpd.</p>
674 <p>The default value for <code class="directive">ThreadLimit</code> is
675 <code>1920</code> when used with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> and
676 <code>64</code> when used with the others.</p>
678 <div class="note"><h3>Note</h3>
679 <p>There is a hard limit of <code>ThreadLimit 20000</code> (or
680 <code>ThreadLimit 15000</code> with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>)
681 compiled into the server. This is intended to avoid nasty effects
682 caused by typos. To increase it even further past this limit, you
683 will need to modify the value of MAX_THREAD_LIMIT in the mpm
684 source file and rebuild the server.</p>
688 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
689 <div class="directive-section"><h2><a name="ThreadsPerChild" id="ThreadsPerChild">ThreadsPerChild</a> <a name="threadsperchild" id="threadsperchild">Directive</a></h2>
690 <table class="directive">
691 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of threads created by each child process</td></tr>
692 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadsPerChild <var>number</var></code></td></tr>
693 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
694 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
695 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
696 <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/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
698 <p>This directive sets the number of threads created by each
699 child process. The child creates these threads at startup and
700 never creates more. If using an MPM like <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>,
701 where there is only one child process, this number should be high
702 enough to handle the entire load of the server. If using an MPM
703 like <code class="module"><a href="../mod/worker.html">worker</a></code>, where there are multiple child processes,
704 the <em>total</em> number of threads should be high enough to handle
705 the common load on the server.</p>
707 <p>The default value for <code class="directive">ThreadsPerChild</code> is
708 <code>64</code> when used with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> and
709 <code>25</code> when used with the others.</p>
712 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
713 <div class="directive-section"><h2><a name="ThreadStackSize" id="ThreadStackSize">ThreadStackSize</a> <a name="threadstacksize" id="threadstacksize">Directive</a></h2>
714 <table class="directive">
715 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The size in bytes of the stack used by threads handling
716 client connections</td></tr>
717 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadStackSize <var>size</var></code></td></tr>
718 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>65536 on NetWare; varies on other operating systems</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/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/event.html">event</a></code></td></tr>
722 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.1 and later</td></tr>
724 <p>The <code class="directive">ThreadStackSize</code> directive sets the
725 size of the stack (for autodata) of threads which handle client
726 connections and call modules to help process those connections.
727 In most cases the operating system default for stack size is
728 reasonable, but there are some conditions where it may need to be
732 <li>On platforms with a relatively small default thread stack size
733 (e.g., HP-UX), Apache httpd may crash when using some third-party modules
734 which use a relatively large amount of autodata storage. Those
735 same modules may have worked fine on other platforms where the
736 default thread stack size is larger. This type of crash is
737 resolved by setting <code class="directive">ThreadStackSize</code> to a
738 value higher than the operating system default. This type of
739 adjustment is necessary only if the provider of the third-party
740 module specifies that it is required, or if diagnosis of an Apache httpd
741 crash indicates that the thread stack size was too small.</li>
743 <li>On platforms where the default thread stack size is
744 significantly larger than necessary for the web server
745 configuration, a higher number of threads per child process
746 will be achievable if <code class="directive">ThreadStackSize</code> is
747 set to a value lower than the operating system default. This type
748 of adjustment should only be made in a test environment which allows
749 the full set of web server processing can be exercised, as there
750 may be infrequent requests which require more stack to process.
751 The minimum required stack size strongly depends on the modules
752 used, but any change in the web server configuration can invalidate
753 the current <code class="directive">ThreadStackSize</code> setting.</li>
755 <li>On Linux, this directive can only be used to increase the default
756 stack size, as the underlying system call uses the value as a
757 <em>minimum</em> stack size. The (often large) soft limit for
758 <code>ulimit -s</code> (8MB if unlimited) is used as the default stack
762 <div class="note">It is recommended to not reduce <code class="directive">ThreadStackSize</code>
763 unless a high number of threads per child process is needed. On some
764 platforms (including Linux), a setting of 128000 is already too low and
765 causes crashes with some common modules.</div>
769 <div class="bottomlang">
770 <p><span>Available Languages: </span><a href="../de/mod/mpm_common.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
771 <a href="../en/mod/mpm_common.html" title="English"> en </a> |
772 <a href="../ja/mod/mpm_common.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
773 <a href="../tr/mod/mpm_common.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
774 </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&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>
775 <script type="text/javascript"><!--//--><![CDATA[//><!--
776 var comments_shortname = 'httpd';
777 var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mpm_common.html';
779 if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
780 d.write('<div id="comments_thread"><\/div>');
781 var s = d.createElement('script');
782 s.type = 'text/javascript';
784 s.src = 'https://c.apaste.info/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
785 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
788 d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
790 })(window, document);
791 //--><!]]></script></div><div id="footer">
792 <p class="apache">Copyright 2012 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>
793 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.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[//><!--
794 if (typeof(prettyPrint) !== 'undefined') {