2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.xsl"?>
7 <description>Multi-Processing Module allowing for daemon processes
8 serving requests to be assigned a variety of different
11 <sourcefile>perchild.c</sourcefile>
12 <identifier>mpm_perchild_module</identifier>
16 This MPM does not currently work on most platforms. Work is ongoing to
20 <p>This Multi-Processing Module (MPM) implements a hybrid
21 multi-process, multi-threaded web server. A fixed number of
22 processes create threads to handle requests. Fluctuations in
23 load are handled by increasing or decreasing the number of
24 threads in each process.</p>
26 <p>A single control process launches the number of child processes
27 indicated by the <directive
28 module="mpm_common">NumServers</directive> directive at server
29 startup. Each child process creates threads as specified in the
30 <code>StartThreads</code> directive. The individual threads then
31 listen for connections and serve them when they arrive.</p>
33 <p>Apache always tries to maintain a pool of <em>spare</em> or
34 idle server threads, which stand ready to serve incoming
35 requests. In this way, clients do not need to wait for new
36 threads to be created. For each child process, Apache assesses
37 the number of idle threads and creates or destroys threads to
38 keep this number within the boundaries specified by
39 <code>MinSpareThreads</code> and <code>MaxSpareThreads</code>.
40 Since this process is very self-regulating, it is rarely
41 necessary to modify these directives from their default values.
42 The maximum number of clients that may be served simultaneously
43 is determined by multiplying the number of server processes
44 that will be created (<code>NumServers</code>) by the maximum
45 number of threads created in each process
46 (<code>MaxThreadsPerChild</code>).</p>
48 <p>While the parent process is usually started as root under
49 Unix in order to bind to port 80, the child processes and
50 threads are launched by Apache as a less-privileged user. The
51 <code>User</code> and <code>Group</code> directives are used to
52 set the privileges of the Apache child processes. The child
53 processes must be able to read all the content that will be
54 served, but should have as few privileges beyond that as
55 possible. In addition, unless <a
56 href="../suexec.html">suexec</a> is used, these directives also
57 set the privileges which will be inherited by CGI scripts.</p>
59 <p><code>MaxRequestsPerChild</code> controls how frequently the
60 server recycles processes by killing old ones and launching new
63 <p>See also: <a href="../bind.html">Setting which addresses and
64 ports Apache uses</a>.</p>
66 <p>In addition it adds the extra ability to specify that
67 specific processes should serve requests under different
68 userids. These processes can then be associated with specific
70 <!-- XXX: This desperately needs more explanation. -->
73 <directivesynopsis location="mpm_common">
74 <name>CoreDumpDirectory</name>
76 <directivesynopsis location="mpm_common">
79 <directivesynopsis location="mpm_common">
82 <directivesynopsis location="mpm_common">
85 <directivesynopsis location="mpm_common">
86 <name>ListenBacklog</name>
88 <directivesynopsis location="mpm_common">
91 <directivesynopsis location="mpm_common">
92 <name>MaxRequestsPerChild</name>
94 <directivesynopsis location="mpm_common">
95 <name>MaxSpareThreads</name>
97 <directivesynopsis location="mpm_common">
98 <name>MaxThreadsPerChild</name>
100 <directivesynopsis location="mpm_common">
101 <name>MinSpareThreads</name>
103 <directivesynopsis location="mpm_common">
104 <name>NumServers</name>
106 <directivesynopsis location="mpm_common">
107 <name>ScoreBoardFile</name>
109 <directivesynopsis location="mpm_common">
110 <name>SendBufferSize</name>
112 <directivesynopsis location="mpm_common">
113 <name>StartThreads</name>
115 <directivesynopsis location="mpm_common">
120 <name>AssignUserId</name>
121 <syntax>AssignUserID <em>user_id</em> <em>group_id</em></syntax>
122 <contextlist><context>virtual host</context></contextlist>
125 <p>Tie a virtual host to a specific child process. Requests addressed to
126 the virtual host where this directive appears will be served by the process
127 running with the specified user and group id.</p>
132 <name>ChildPerUserId</name>
133 <syntax>ChildPerUserID <em>user_id</em>
134 <em>group_id</em> <em>child_id</em></syntax>
135 <contextlist><context>server config</context></contextlist>
138 <p>Specify a user id and group id for a specific child process. The number of
139 children if set by the <a href="mpm_common.html#numservers">NumServers</a>
140 directive. For example, the default value for <a
141 href="mpm_common.html#numservers">NumServers</a> is 5 and that means
142 children ids 1,2,3,4 and 5 are available for assigment. If a child does not
143 have an associated ChildPerUserID, it inherits the <a
144 href="mpm_common.html#user">User</a> and <a
145 href="mpm_common.html#group">Group</a> settings from the main server </p>