<description>Maximum number of child processes that will be created
to serve requests</description>
<syntax>MaxClients <em>number</em></syntax>
-<default>MaxClients
- 8 (with threads) MaxClients 256</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>worker</module><module>prefork</module>
</modulelist>
<usage>
<p>The <directive>MaxClients</directive> directive sets the limit
- on the number of child processes that will be created to serve
- requests. When the server is built without threading, no more than
- this number of clients can be served simultaneously. To configure
- more than 256 clients with the prefork MPM, you must use the
- <directive module="mpm_common">ServerLimit</directive> directive.
- To configure more than 1024 clients with the worker MPM, you must
- use the <directive module="mpm_common">ServerLimit</directive> and
- <directive module="mpm_common">ThreadLimit</directive> directives.</p>
-
- <p>Any connection attempts over the
- <directive>MaxClients</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>When the server is compiled with threading, then the maximum
- number of simultaneous requests that can be served is obtained
- from the value of this directive multiplied by
- <directive module="mpm_common">ThreadsPerChild</directive>.</p>
+ on the number of simultaneous requests that will be served. Any
+ connection attempts over the <directive>MaxClients</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 (i.e., <module>prefork</module>),
+ <directive>MaxClients</directive> translates into the maximum
+ number of child processes that will be launched to serve requests.
+ The default value is 256; to increase it, you must also raise
+ <directive module="mpm_common">ServerLimit</directive>.</p>
+
+ <p>For threaded servers (i.e., <module>worker</module>),
+ <directive>MaxClients</directive> restricts the total
+ number of threads that will be available to serve clients.
+ The default value is 16 multiplied by the value of
+ <directive module="mpm_common">ThreadsPerChild</directive>.
+ To increase <directive>MaxClients</directive> to a value
+ that requires more than 16 processes, you must also
+ raise <directive module="mpm_common">ServerLimit</directive>.</p>
</usage>
</directivesynopsis>
idle server threads, which stand ready to serve incoming
requests. In this way, clients do not need to wait for a new
threads or processes to be created before their requests can be
- served. Apache assesses the total number of idle threads in all
- processes, and forks or kills processes to keep this number within
- the boundaries specified by <directive
+ served. The number of processes that will initially launched is
+ set by the <directive module="mpm_common">StartServers</directive>
+ directive. Then during operation, Apache assesses the total number
+ of idle threads in all processes, and forks or kills processes to
+ keep this number within the boundaries specified by <directive
module="mpm_common">MinSpareThreads</directive> and <directive
module="mpm_common">MaxSpareThreads</directive>. Since this
process is very self-regulating, it is rarely necessary to modify
these directives from their default values. The maximum number of
- clients that may be served simultaneously is determined by
- multiplying the maximum number of server processes that will be
- created (<directive module="mpm_common">MaxClients</directive>) by
- the number of threads created in each process (<directive
- module="mpm_common">ThreadsPerChild</directive>).</p>
+ clients that may be served simultaneously (i.e., the maximum total
+ number of threads in all processes) is determined by the
+ <directive module="mpm_common">MaxClients</directive> directive,
+ while the maximum number of processes that can be launched is set
+ by the <directive module="mpm_common">ServerLimit</directive>
+ directive. <directive module="mpm_common">ServerLimit</directive>
+ multiplied by <directive
+ module="mpm_common">ThreadsPerChild</directive> must be greater
+ than or equal to <directive
+ module="mpm_common">MaxClients</directive></p>
+
+ <p>A typical configuration of the process-thread controls in
+ the <module>worker</module> MPM could look as follows:</p>
+
+<example><pre>StartServers 2
+MaxClients 150
+MinSpareThreads 25
+MaxSpareThreads 75
+ThreadsPerChild 25
+ServerLimit 16</pre></example>
<p>While the parent process is usually started as root under Unix
in order to bind to port 80, the child processes and threads are