<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
<!-- $LastChangedRevision$ -->

<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<modulesynopsis metafile="mpm_common.xml.meta">

<name>mpm_common</name>
<description>A collection of directives that are implemented by
more than one multi-processing module (MPM)</description>
<status>MPM</status>

<directivesynopsis>
<name>CoreDumpDirectory</name>
<description>Directory where Apache HTTP Server attempts to
switch before dumping core</description>
<syntax>CoreDumpDirectory <var>directory</var></syntax>
<default>See usage for the default setting</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>event</module><module>prefork</module>
<module>worker</module></modulelist>

<usage>
    <p>This controls the directory to which Apache httpd attempts to
    switch before dumping core. If your operating system is configured to
    create core files in the working directory of the crashing process,
    <directive>CoreDumpDirectory</directive> is necessary to change working
    directory from the default <directive module="core">ServerRoot</directive>
    directory, which should not be writable by the user the server runs as.</p>

    <p>If you want a core dump for debugging, you can use this directive to
    place it in a different location. This directive has no effect if your
    operating system is not configured to write core files to the working directory
    of the crashing processes.</p>

    <note><title>Core Dumps on Linux</title>
      <p>If Apache httpd starts as root and switches to another user, the
      Linux kernel <em>disables</em> core dumps even if the directory is
      writable for the process. Apache httpd (2.0.46 and later) reenables core dumps
      on Linux 2.4 and beyond, but only if you explicitly configure a <directive
      >CoreDumpDirectory</directive>.</p>
    </note>

    <note>
    <title>Core Dumps on BSD</title>
    <p>To enable core-dumping of suid-executables on BSD-systems (such
    as FreeBSD), set <code>kern.sugid_coredump</code> to 1.
    </p>
    </note>

    <note><title>Specific signals</title>
      <p><directive>CoreDumpDirectory</directive> processing only occurs for
      a select set of fatal signals: SIGFPE, SIGILL, SIGABORT,
      SIGSEGV, and SIGBUS.</p>
      <p>On some operating systems, SIGQUIT also results in a core dump but
      does not go through <directive>CoreDumpDirectory</directive> or
      <directive>EnableExceptionHook</directive> processing, so the core
      location is dictated entirely by the operating system.</p>
    </note>

</usage>
</directivesynopsis>

<directivesynopsis>
<name>EnableExceptionHook</name>
<description>Enables a hook that runs exception handlers
after a crash</description>
<syntax>EnableExceptionHook On|Off</syntax>
<default>EnableExceptionHook Off</default>
<contextlist><context>server config</context></contextlist>
<modulelist>
<module>event</module><module>prefork</module>
<module>worker</module></modulelist>

<usage>
    <p>For safety reasons this directive is only available if the server was
    configured with the <code>--enable-exception-hook</code> option. It
    enables a hook that allows external modules to plug in and do something
    after a child crashed.</p>

    <p>There are already two modules, <code>mod_whatkilledus</code> and
    <code>mod_backtrace</code> that make use of this hook. Please have a
    look at Jeff Trawick's <a
    href="http://people.apache.org/~trawick/exception_hook.html"
    >EnableExceptionHook site</a> for more information about these.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>GracefulShutdownTimeout</name>
<description>Specify a timeout after which a gracefully shutdown server
will exit.</description>
<syntax>GracefulShutDownTimeout <var>seconds</var></syntax>
<default>GracefulShutDownTimeout 0</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>prefork</module><module>worker</module>
<module>event</module></modulelist>
<compatibility>Available in version 2.2 and later</compatibility>

<usage>
    <p>The <directive>GracefulShutdownTimeout</directive> specifies
    how many seconds after receiving a "graceful-stop" signal, a
    server should continue to run, handling the existing connections.</p>

    <p>Setting this value to zero means that the server will wait
    indefinitely until all remaining requests have been fully served.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>PidFile</name>
<description>File where the server records the process ID
of the daemon</description>
<syntax>PidFile <var>filename</var></syntax>
<default>PidFile logs/httpd.pid</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>event</module><module>mpm_winnt</module>
<module>mpmt_os2</module><module>prefork</module><module>worker</module>
</modulelist>

<usage>
    <p>The <directive>PidFile</directive> directive sets the file to
    which the server records the process id of the daemon. If the
    filename is not absolute then it is assumed to be relative to the
    <directive module="core">ServerRoot</directive>.</p>

    <example><title>Example</title>
    <highlight language="config">
      PidFile /var/run/apache.pid
      </highlight>
    </example>

    <p>It is often useful to be able to send the server a signal,
    so that it closes and then re-opens its <directive
    module="core">ErrorLog</directive> and <directive
    module="mod_log_config">TransferLog</directive>, and
    re-reads its configuration files. This is done by sending a
    SIGHUP (kill -1) signal to the process id listed in the
    <directive>PidFile</directive>.</p>

    <p>The <directive>PidFile</directive> is subject to the same
    warnings about log file placement and <a
    href="../misc/security_tips.html#serverroot">security</a>.</p>

    <note><title>Note</title>
      <p>As of Apache HTTP Server 2, we recommended that you only use the <program>
      apachectl</program> script, or the init script that your OS provides,
      for (re-)starting or stopping the server.</p>
    </note>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>Listen</name>
<description>IP addresses and ports that the server
listens to</description>
<syntax>Listen [<var>IP-address</var>:]<var>portnumber</var> [<var>protocol</var>]</syntax>
<contextlist><context>server config</context></contextlist>
<modulelist><module>mpm_netware</module><module>mpm_winnt</module>
<module>mpmt_os2</module>
<module>prefork</module><module>worker</module>
<module>event</module>
</modulelist>
<compatibility>The <var>protocol</var> argument was added in 2.1.5</compatibility>

<usage>
    <p>The <directive>Listen</directive> directive instructs Apache httpd to
    listen to only specific IP addresses or ports; by default it
    responds to requests on all IP interfaces. <directive>Listen</directive>
    is now a required directive. If it is not in the config file, the
    server will fail to start. This is a change from previous versions
    of Apache httpd.</p>

    <p>The <directive>Listen</directive> directive tells the server to
    accept incoming requests on the specified port or address-and-port
    combination. If only a port number is specified, the server listens to
    the given port on all interfaces. If an IP address is given as well
    as a port, the server will listen on the given port and
    interface.</p>

    <p>Multiple <directive>Listen</directive> directives may be used to
    specify a number of addresses and ports to listen to. The server will
    respond to requests from any of the listed addresses and ports.</p>

    <p>For example, to make the server accept connections on both
    port 80 and port 8000, use:</p>

    <highlight language="config">
Listen 80
Listen 8000
    </highlight>

    <p>To make the server accept connections on two specified
    interfaces and port numbers, use </p>

    <highlight language="config">
Listen 192.170.2.1:80
Listen 192.170.2.5:8000
    </highlight>

    <p>IPv6 addresses must be surrounded in square brackets, as in the
    following example:</p>

    <highlight language="config">
      Listen [2001:db8::a00:20ff:fea7:ccea]:80
    </highlight>

    <p>The optional <var>protocol</var> argument is not required for most
       configurations. If not specified, <code>https</code> is the default for
       port 443 and <code>http</code> the default for all other ports.  The
       protocol is used to determine which module should handle a request, and
       to apply protocol specific optimizations with the
       <directive module="core">AcceptFilter</directive> directive.</p>

    <p>You only need to set the protocol if you are running on non-standard
       ports.  For example, running an <code>https</code> site on port 8443:</p>

    <highlight language="config">
      Listen 192.170.2.1:8443 https
    </highlight>

    <note><title>Error condition</title>
      Multiple <directive>Listen</directive> directives for the same ip
      address and port will result in an <code>Address already in use</code>
      error message.
    </note>

</usage>
<seealso><a href="../dns-caveats.html">DNS Issues</a></seealso>
<seealso><a href="../bind.html">Setting which addresses and ports Apache HTTP Server
    uses</a></seealso>
<seealso><a
href="http://wiki.apache.org/httpd/CouldNotBindToAddress">Further
discussion of the <code>Address already in use</code> error message,
including other causes.</a></seealso>
</directivesynopsis>

<directivesynopsis>
<name>ListenBackLog</name>
<description>Maximum length of the queue of pending connections</description>
<syntax>ListenBacklog <var>backlog</var></syntax>
<default>ListenBacklog 511</default>
<contextlist><context>server config</context></contextlist>
<modulelist>
<module>event</module>
<module>mpm_netware</module><module>mpm_winnt</module>
<module>mpmt_os2</module><module>prefork</module>
<module>worker</module></modulelist>

<usage>
    <p>The maximum length of the queue of pending connections.
    Generally no tuning is needed or desired, however on some
    systems it is desirable to increase this when under a TCP SYN
    flood attack. See the backlog parameter to the
    <code>listen(2)</code> system call.</p>

    <p>This will often be limited to a smaller number by the
    operating system. This varies from OS to OS. Also note that
    many OSes do not use exactly what is specified as the backlog,
    but use a number based on (but normally larger than) what is
    set.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>MaxRequestWorkers</name>
<description>Maximum number of connections that will be processed
simultaneously</description>
<syntax>MaxRequestWorkers <var>number</var></syntax>
<default>See usage for details</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>event</module><module>prefork</module>
<module>worker</module>
</modulelist>

<usage>
    <p>The <directive>MaxRequestWorkers</directive> directive sets the limit
    on the number of simultaneous requests that will be served.  Any
    connection attempts over the <directive>MaxRequestWorkers</directive>
    limit will normally be queued, up to a number based on the
    <directive module="mpm_common">ListenBacklog</directive>
    directive. Once a child process is freed at the end of a different
    request, the connection will then be serviced.</p>

    <p>For non-threaded servers (<em>i.e.</em>, <module>prefork</module>),
    <directive>MaxRequestWorkers</directive> translates into the maximum
    number of child processes that will be launched to serve requests.
    The default value is <code>256</code>; to increase it, you must also raise
    <directive module="mpm_common">ServerLimit</directive>.</p>

    <p>For threaded and hybrid servers (<em>e.g.</em> <module>event</module>
    or <module>worker</module>) <directive>MaxRequestWorkers</directive> restricts
    the total number of threads that will be available to serve clients.
    For hybrid MPMs the default value is <code>16</code> (<directive
    module="mpm_common">ServerLimit</directive>) multiplied by the value of
    <code>25</code> (<directive module="mpm_common"
    >ThreadsPerChild</directive>). Therefore, to increase <directive
    >MaxRequestWorkers</directive> to a value that requires more than 16 processes,
    you must also raise <directive module="mpm_common"
    >ServerLimit</directive>.</p>

    <p><directive>MaxRequestWorkers</directive> was called
    <directive>MaxClients</directive> before version 2.3.13. The old name is still
    supported.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>MaxMemFree</name>
<description>Maximum amount of memory that the main allocator is allowed
to hold without calling <code>free()</code></description>
<syntax>MaxMemFree <var>KBytes</var></syntax>
<default>MaxMemFree 2048</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>event</module><module>mpm_netware</module>
<module>prefork</module><module>worker</module><module>mpm_winnt</module>
</modulelist>

<usage>
    <p>The <directive>MaxMemFree</directive> directive sets the
    maximum number of free Kbytes that every allocator is allowed
    to hold without calling <code>free()</code>. In threaded MPMs, every
    thread has its own allocator. When set
    to zero, the threshold will be set to unlimited.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>MaxConnectionsPerChild</name>
<description>Limit on the number of connections that an individual child server
will handle during its life</description>
<syntax>MaxConnectionsPerChild <var>number</var></syntax>
<default>MaxConnectionsPerChild 0</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>event</module><module>mpm_netware</module>
<module>mpm_winnt</module><module>mpmt_os2</module>
<module>prefork</module><module>worker</module></modulelist>
<compatibility>Available Apache HTTP Server 2.3.9 and later. The old name
<code>MaxRequestsPerChild</code> is still supported.</compatibility>

<usage>
    <p>The <directive>MaxConnectionsPerChild</directive> directive sets
    the limit on the number of connections that an individual child
    server process will handle. After
    <directive>MaxConnectionsPerChild</directive> connections, the child
    process will die. If <directive>MaxConnectionsPerChild</directive> is
    <code>0</code>, then the process will never expire.</p>

    <p>Setting <directive>MaxConnectionsPerChild</directive> to a
    non-zero value limits the amount of memory that process can consume
    by (accidental) memory leakage.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>MaxSpareThreads</name>
<description>Maximum number of idle threads</description>
<syntax>MaxSpareThreads <var>number</var></syntax>
<default>See usage for details</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>event</module><module>mpm_netware</module>
<module>mpmt_os2</module><module>worker</module></modulelist>

<usage>
    <p>Maximum number of idle threads. Different MPMs deal with this
    directive differently.</p>

    <p>For <module>worker</module>, the default is
    <code>MaxSpareThreads 250</code>. This MPM deals with idle threads
    on a server-wide basis. If there are too many idle threads in the
    server then child processes are killed until the number of idle
    threads is less than this number.</p>

    <p>For <module>mpm_netware</module> the default is
    <code>MaxSpareThreads 100</code>. Since this MPM runs a
    single-process, the spare thread count is also server-wide.</p>

    <p><module>mpmt_os2</module> works
    similar to <module>mpm_netware</module>. For
    <module>mpmt_os2</module> the default value is <code>10</code>.</p>

    <note><title>Restrictions</title>
      <p>The range of the <directive>MaxSpareThreads</directive> value
      is restricted. Apache httpd will correct the given value automatically
      according to the following rules:</p>
      <ul>
        <li><module>mpm_netware</module> wants the value to be greater than
        <directive module="mpm_common">MinSpareThreads</directive>.</li>

        <li>For <module>worker</module>, the value must be greater or equal
        to the sum of <directive module="mpm_common">MinSpareThreads</directive>
        and <directive module="mpm_common">ThreadsPerChild</directive>.</li>
      </ul>
    </note>
</usage>
<seealso><directive module="mpm_common">MinSpareThreads</directive></seealso>
<seealso><directive module="mpm_common">StartServers</directive></seealso>
<seealso><directive module="prefork">MaxSpareServers</directive></seealso>
</directivesynopsis>

<directivesynopsis>
<name>MinSpareThreads</name>
<description>Minimum number of idle threads available to handle request
spikes</description>
<syntax>MinSpareThreads <var>number</var></syntax>
<default>See usage for details</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>event</module><module>mpm_netware</module>
<module>mpmt_os2</module><module>worker</module></modulelist>

<usage>
    <p>Minimum number of idle threads to handle request spikes.
    Different MPMs deal with this directive
    differently.</p>

    <p><module>worker</module> uses a default of <code>MinSpareThreads
    75</code> and deals with idle threads on a server-wide basis. If
    there aren't enough idle threads in the server then child
    processes are created until the number of idle threads is greater
    than <var>number</var>.</p>

    <p><module>mpm_netware</module> uses a default of
    <code>MinSpareThreads 10</code> and, since it is a single-process
    MPM, tracks this on a server-wide bases.</p>

    <p><module>mpmt_os2</module> works
    similar to <module>mpm_netware</module>.  For
    <module>mpmt_os2</module> the default value is <code>5</code>.</p>
</usage>
<seealso><directive module="mpm_common">MaxSpareThreads</directive></seealso>
<seealso><directive module="mpm_common">StartServers</directive></seealso>
<seealso><directive module="prefork">MinSpareServers</directive></seealso>
</directivesynopsis>

<directivesynopsis>
<name>ScoreBoardFile</name>
<description>Location of the file used to store coordination data for
the child processes</description>
<syntax>ScoreBoardFile <var>file-path</var></syntax>
<default>ScoreBoardFile logs/apache_runtime_status</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>event</module><module>mpm_winnt</module>
<module>prefork</module><module>worker</module></modulelist>

<usage>
    <p>Apache HTTP Server uses a scoreboard to communicate between its parent
    and child processes.  Some architectures require a file to facilitate
    this communication. If the file is left unspecified, Apache httpd first
    attempts to create the scoreboard entirely in memory (using anonymous
    shared memory) and, failing that, will attempt to create the file on
    disk (using file-based shared memory). Specifying this directive causes
    Apache httpd to always create the file on the disk.</p>

    <example><title>Example</title>
    <highlight language="config">
      ScoreBoardFile /var/run/apache_runtime_status
      </highlight>
    </example>

    <p>File-based shared memory is useful for third-party applications
    that require direct access to the scoreboard.</p>

    <p>If you use a <directive>ScoreBoardFile</directive> then
    you may see improved speed by placing it on a RAM disk. But be
    careful that you heed the same warnings about log file placement
    and <a href="../misc/security_tips.html">security</a>.</p>
</usage>
<seealso><a href="../stopping.html">Stopping and Restarting
Apache HTTP Server</a></seealso>
</directivesynopsis>

<directivesynopsis>
<name>ReceiveBufferSize</name>
<description>TCP receive buffer size</description>
<syntax>ReceiveBufferSize <var>bytes</var></syntax>
<default>ReceiveBufferSize 0</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>event</module><module>mpm_netware</module>
<module>mpm_winnt</module><module>mpmt_os2</module><module>prefork</module>
<module>worker</module></modulelist>

<usage>
    <p>The server will set the TCP receive buffer size to the number of
    bytes specified.</p>

    <p>If set to the value of <code>0</code>, the server will use the
    OS default.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>SendBufferSize</name>
<description>TCP buffer size</description>
<syntax>SendBufferSize <var>bytes</var></syntax>
<default>SendBufferSize 0</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>event</module><module>mpm_netware</module>
<module>mpm_winnt</module><module>mpmt_os2</module><module>prefork</module>
<module>worker</module></modulelist>

<usage>
    <p>Sets the server's TCP send buffer size to the number of bytes
    specified. It is often useful to set this past the OS's standard
    default value on high speed, high latency connections
    (<em>i.e.</em>, 100ms or so, such as transcontinental fast pipes).</p>

    <p>If set to the value of <code>0</code>, the server will use the
    default value provided by your OS.</p>

    <p>Further configuration of your operating system may be required to elicit
    better performance on high speed, high latency connections.</p>

    <note> <p> On some operating systems, changes in TCP behavior resulting
    from a larger <directive>SendBufferSize</directive> may not be seen unless
    <directive module="core">EnableSendfile</directive> is set to OFF.  This
    interaction applies only to static files.</p> </note>

</usage>
</directivesynopsis>

<directivesynopsis>
<name>ServerLimit</name>
<description>Upper limit on configurable number of processes</description>
<syntax>ServerLimit <var>number</var></syntax>
<default>See usage for details</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>event</module><module>prefork</module>
<module>worker</module></modulelist>

<usage>
    <p>For the <module>prefork</module> MPM, this directive sets the
    maximum configured value for <directive
    module="mpm_common">MaxRequestWorkers</directive> for the lifetime of the
    Apache httpd process.  For the <module>worker</module> MPM, this directive
    in combination with <directive
    module="mpm_common">ThreadLimit</directive> sets
    the maximum configured value for <directive
    module="mpm_common">MaxRequestWorkers</directive> for the lifetime of the
    Apache httpd process.  Any attempts to change this directive during a
    restart will be ignored, but <directive
    module="mpm_common">MaxRequestWorkers</directive> can be modified during
    a restart.</p>

    <p>Special care must be taken when using this directive.  If
    <directive>ServerLimit</directive> is set to a value much higher
    than necessary, extra, unused shared memory will be allocated.  If
    both <directive>ServerLimit</directive> and <directive
    module="mpm_common">MaxRequestWorkers</directive> are set to values
    higher than the system can handle, Apache httpd may not start or the
    system may become unstable.</p>

    <p>With the <module>prefork</module> MPM, use this directive only
    if you need to set <directive
    module="mpm_common">MaxRequestWorkers</directive> higher than 256 (default).
    Do not set the value of this directive any higher than what you
    might want to set <directive
    module="mpm_common">MaxRequestWorkers</directive> to.</p>

    <p>With <module>worker</module>, use this directive only
    if your <directive module="mpm_common">MaxRequestWorkers</directive> and
    <directive module="mpm_common">ThreadsPerChild</directive>
    settings require more than 16 server processes (default). Do not set
    the value of this directive any higher than the number of server
    processes required by what you may want for <directive
    module="mpm_common">MaxRequestWorkers </directive> and <directive
    module="mpm_common">ThreadsPerChild</directive>.</p>

    <note><title>Note</title>
      <p>There is a hard limit of <code>ServerLimit 20000</code> compiled
      into the server (for the <module>prefork</module> MPM 200000). This is
      intended to avoid nasty effects caused by typos. To increase it
      even further past this limit, you will need to modify the value of
      MAX_SERVER_LIMIT in the mpm source file and rebuild the server.</p>
    </note>
</usage>
<seealso><a href="../stopping.html">Stopping and Restarting Apache HTTP Server</a></seealso>
</directivesynopsis>

<directivesynopsis>
<name>StartServers</name>
<description>Number of child server processes created at startup</description>
<syntax>StartServers <var>number</var></syntax>
<default>See usage for details</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>event</module><module>mpmt_os2</module>
<module>prefork</module><module>worker</module>
</modulelist>

<usage>
    <p>The <directive>StartServers</directive> directive sets the
    number of child server processes created on startup. As the number
    of processes is dynamically controlled depending on the load, (see
    <directive module="mpm_common">MinSpareThreads</directive>,
    <directive module="mpm_common">MaxSpareThreads</directive>,
    <directive module="prefork">MinSpareServers</directive>, <directive
    module="prefork">MaxSpareServers</directive>)
    there is usually little reason to adjust this parameter.</p>

    <p>The default value differs from MPM to MPM. <module>worker</module>
    defaults to <code>StartServers 3</code>; <module>prefork</module>
    defaults to <code>5</code>; <module>mpmt_os2</module> defaults to
    <code>2</code>.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>StartThreads</name>
<description>Number of threads created on startup</description>
<syntax>StartThreads <var>number</var></syntax>
<default>See usage for details</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>mpm_netware</module></modulelist>

<usage>
    <p>Number of threads created on startup. As the
    number of threads is dynamically controlled depending on the
    load, (see
    <directive module="mpm_common">MinSpareThreads</directive>,
    <directive module="mpm_common">MaxSpareThreads</directive>,
    <directive module="prefork">MinSpareServers</directive>, <directive
    module="prefork">MaxSpareServers</directive>)
    there is usually little reason to adjust this
    parameter.</p>

    <p>For <module>mpm_netware</module> the default is
    <code>StartThreads 50</code> and, since there is only a single
    process, this is the total number of threads created at startup to
    serve requests.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>ThreadLimit</name>
<description>Sets the upper limit on the configurable number of threads
per child process</description>
<syntax>ThreadLimit <var>number</var></syntax>
<default>See usage for details</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>event</module><module>mpm_winnt</module>
<module>worker</module></modulelist>

<usage>
    <p>This directive sets the maximum configured value for <directive
    module="mpm_common">ThreadsPerChild</directive> for the lifetime
    of the Apache httpd process.  Any attempts to change this directive
    during a restart will be ignored, but <directive
    module="mpm_common">ThreadsPerChild</directive> can be modified
    during a restart up to the value of this directive.</p>

    <p>Special care must be taken when using this directive.  If
    <directive>ThreadLimit</directive> is set to a value much higher
    than <directive module="mpm_common">ThreadsPerChild</directive>,
    extra unused shared memory will be allocated.  If both
    <directive>ThreadLimit</directive> and <directive
    module="mpm_common">ThreadsPerChild</directive> are set to values
    higher than the system can handle, Apache httpd may not start or the
    system may become unstable. Do not set the value of this directive
    any higher than your greatest predicted setting of <directive
    module="mpm_common">ThreadsPerChild</directive> for the
    current run of Apache httpd.</p>

    <p>The default value for <directive>ThreadLimit</directive> is
    <code>1920</code> when used with <module>mpm_winnt</module> and
    <code>64</code> when used with the others.</p>

    <note><title>Note</title>
      <p>There is a hard limit of <code>ThreadLimit 20000</code> (or
      <code>ThreadLimit 100000</code> with <module>event</module>,
      <code>ThreadLimit 15000</code> with <module>mpm_winnt</module>)
      compiled into the server. This is intended to avoid nasty effects
      caused by typos. To increase it even further past this limit, you
      will need to modify the value of MAX_THREAD_LIMIT in the mpm
      source file and rebuild the server.</p>
    </note>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>ThreadsPerChild</name>
<description>Number of threads created by each child process</description>
<syntax>ThreadsPerChild <var>number</var></syntax>
<default>See usage for details</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>event</module><module>mpm_winnt</module>
<module>worker</module></modulelist>

<usage>
    <p>This directive sets the number of threads created by each
    child process. The child creates these threads at startup and
    never creates more. If using an MPM like <module>mpm_winnt</module>,
    where there is only one child process, this number should be high
    enough to handle the entire load of the server. If using an MPM
    like <module>worker</module>, where there are multiple child processes,
    the <em>total</em> number of threads should be high enough to handle
    the common load on the server.</p>

    <p>The default value for <directive>ThreadsPerChild</directive> is
    <code>64</code> when used with <module>mpm_winnt</module> and
    <code>25</code> when used with the others.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>ThreadStackSize</name>
<description>The size in bytes of the stack used by threads handling
client connections</description>
<syntax>ThreadStackSize <var>size</var></syntax>
<default>65536 on NetWare; varies on other operating systems</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>event</module><module>mpm_netware</module>
<module>mpmt_os2</module><module>mpm_winnt</module><module>worker</module>
<module>event</module>
</modulelist>
<compatibility>Available in Apache HTTP Server 2.1 and later</compatibility>

<usage>
    <p>The <directive>ThreadStackSize</directive> directive sets the
    size of the stack (for autodata) of threads which handle client
    connections and call modules to help process those connections.
    In most cases the operating system default for stack size is
    reasonable, but there are some conditions where it may need to be
    adjusted:</p>

    <ul>
      <li>On platforms with a relatively small default thread stack size
      (e.g., HP-UX), Apache httpd may crash when using some third-party modules
      which use a relatively large amount of autodata storage.  Those
      same modules may have worked fine on other platforms where the
      default thread stack size is larger.  This type of crash is
      resolved by setting <directive>ThreadStackSize</directive> to a
      value higher than the operating system default.  This type of
      adjustment is necessary only if the provider of the third-party
      module specifies that it is required, or if diagnosis of an Apache httpd
      crash indicates that the thread stack size was too small.</li>

      <li>On platforms where the default thread stack size is
      significantly larger than necessary for the web server
      configuration, a higher number of threads per child process
      will be achievable if <directive>ThreadStackSize</directive> is
      set to a value lower than the operating system default.  This type
      of adjustment should only be made in a test environment which allows
      the full set of web server processing can be exercised, as there
      may be infrequent requests which require more stack to process.
      The minimum required stack size strongly depends on the modules
      used, but any change in the web server configuration can invalidate
      the current <directive>ThreadStackSize</directive> setting.</li>

      <li>On Linux, this directive can only be used to increase the default
      stack size, as the underlying system call uses the value as a
      <em>minimum</em> stack size.  The (often large) soft limit for
      <code>ulimit -s</code> (8MB if unlimited) is used as the default stack
      size.</li>
    </ul>

    <note>It is recommended to not reduce <directive>ThreadStackSize</directive>
    unless a high number of threads per child process is needed. On some
    platforms (including Linux), a setting of 128000 is already too low and
    causes crashes with some common modules.</note>
</usage>
</directivesynopsis>

</modulesynopsis>
