279N/A<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
279N/A<
TITLE>Apache MPM threaded</
TITLE>
279N/A<!-- Background white, links blue (unvisited), navy (visited), red (active) --> 279N/A<
H1 ALIGN="CENTER">Multi-Processing Module threaded</
H1>
279N/AThis Multi-Processing Module implements a hybrid multi-threaded
279N/Amulti-process web server.
279N/A><
STRONG>Status:</
STRONG></
A> MPM
279N/A><
STRONG>Module Identifier:</
STRONG></
A> mpm_threaded_module
279N/A<
p>This Multi-Processing Module (MPM) is the default for most unix-like
279N/Aoperating systems. It implements a hybrid
279N/Amulti-process multi-threaded server. Each process has a fixed number
1604N/Aof threads. The server adjusts to handle load by increasing or
279N/Adecreasing the number of processes.</
p>
279N/A<
p>A single control process is responsible for launching child
279N/Aprocesses. Each child process creates a fixed number of threads as
279N/Aspecified in the <
code>ThreadsPerChild</
code> directive.
840N/AThe individual threads then listen for connections and
447N/Aserve them when they arrive.</
p>
447N/A<
p>Apache always tries to maintain a pool of <
em>spare</
em> or idle
447N/Aserver threads, which stand ready to serve incoming requests. In this
447N/Away, clients do not need to wait for a new threads or processes to be
447N/Acreated before their requests can be served. Apache assesses the
447N/Atotal number of idle threads in all processes, and forks or kills
924N/Aprocesses to keep this number within the boundaries specified by
279N/A<
code>MinSpareThreads</
code> and <
code>MaxSpareThreads</
code>.
279N/ASince this process is very self-regulating, it is rarely necessary to
279N/Amodify these directives from their default values. The maximum
279N/Anumber of clients that may be served simultaneously is determined
447N/Aby multiplying the maximum number of server processes that
279N/Awill be created (<
code>MaxClients</
code>) by the number of threads
279N/Acreated in each process (<
code>ThreadsPerChild</
code>).</
p>
447N/A<
p>While the parent process is usually started as root under Unix in
279N/Aorder to bind to port 80, the child processes and threads are launched
447N/Aby Apache as a less-privileged user. The <
code>User</
code> and
279N/A<
code>Group</
code> directives are used to set the privileges of the
279N/AApache child processes. The child processes must be able to read all
279N/Athe content that will be served, but should have as few privileges
279N/Abeyond that as possible. In addition, unless <
a 279N/Athe privileges which will be inherited by CGI scripts.</
p>
<
p><
code>MaxRequestsPerChild</
code> controls how frequently the server
recycles processes by killing old ones and launching new ones.</
p>
<
p>See also: <
a href="/bind.html">Setting which addresses and ports
<
li><
a href="mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</
a></
li>