]> granicus.if.org Git - apache/blob - docs/manual/mod/prefork.xml
add the metafile attribute to all xml files.
[apache] / docs / manual / mod / prefork.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <modulesynopsis metafile="prefork.xml.meta">
5
6 <name>prefork</name>
7 <description>Implements a non-threaded, pre-forking web server</description>
8 <status>MPM</status>
9 <sourcefile>prefork.c</sourcefile>
10 <identifier>mpm_prefork_module</identifier>
11
12 <summary>
13     <p>This Multi-Processing Module (MPM) implements a non-threaded,
14     pre-forking web server that handles requests in a manner similar
15     to Apache 1.3.  It is appropriate for sites that need to avoid
16     threading for compatibility with non-thread-safe libraries.  It
17     is also the best MPM for isolating each request, so that a problem
18     with a single request will not affect any other.</p>
19
20     <p>This MPM is very self-regulating, so it is rarely necessary to
21     adjust its configuration directives.  Most important is that
22     <directive module="mpm_common">MaxClients</directive> be big enough to 
23     handle as many simultaneous requests as you expect to receive, but
24     small enough to assure that there is enough physical RAM for all
25     processes.</p>
26 </summary>
27 <seealso><a href="../bind.html">Setting which addresses and ports Apache
28 uses</a></seealso>
29
30 <section id="how-it-works"><title>How it Works</title>
31     <p>A single control process is responsible for launching child
32     processes which listen for connections and serve them when they
33     arrive. Apache always tries to maintain several <dfn>spare</dfn>
34     or idle server processes, which stand ready to serve incoming
35     requests. In this way, clients do not need to wait for a new
36     child processes to be forked before their requests can be
37     served.</p>
38
39     <p>The <directive module="mpm_common">StartServers</directive>,
40     <directive module="prefork">MinSpareServers</directive>,
41     <directive module="prefork">MaxSpareServers</directive>, and
42     <directive module="mpm_common">MaxClients</directive> regulate how
43     the parent process creates children to serve requests. In general,
44     Apache is very self-regulating, so most sites do not need to
45     adjust these directives from their default values. Sites which
46     need to serve more than 256 simultaneous requests may need to
47     increase <directive module="mpm_common">MaxClients</directive>,
48     while sites with limited memory may need to decrease <directive
49     module="mpm_common">MaxClients</directive> to keep the server from
50     thrashing (swapping memory to disk and back). More information
51     about tuning process creation is provided in the <a
52     href="../misc/perf-tuning.html">performance hints</a>
53     documentation.</p>
54
55     <p>While the parent process is usually started as <code>root</code>
56     under Unix in order to bind to port 80, the child processes are
57     launched by Apache as a less-privileged user. The <directive
58     module="mpm_common">User</directive> and <directive
59     module="mpm_common">Group</directive> directives are used to set
60     the privileges of the Apache child processes. The child processes
61     must be able to read all the content that will be served, but
62     should have as few privileges beyond that as possible.</p>
63
64     <p><directive module="mpm_common">MaxRequestsPerChild</directive>
65     controls how frequently the server recycles processes by killing
66     old ones and launching new ones.</p>
67 </section>
68
69 <directivesynopsis location="mpm_common"><name>BS2000Account</name>
70 </directivesynopsis>
71 <directivesynopsis location="mpm_common"><name>CoreDumpDirectory</name>
72 </directivesynopsis>
73 <directivesynopsis location="mpm_common"><name>PidFile</name>
74 </directivesynopsis>
75 <directivesynopsis location="mpm_common"><name>Listen</name>
76 </directivesynopsis>
77 <directivesynopsis location="mpm_common"><name>ListenBacklog</name>
78 </directivesynopsis>
79 <directivesynopsis location="mpm_common"><name>LockFile</name>
80 </directivesynopsis>
81 <directivesynopsis location="mpm_common"><name>MaxClients</name>
82 </directivesynopsis>
83 <directivesynopsis location="mpm_common"><name>MaxMemFree</name>
84 </directivesynopsis>
85 <directivesynopsis location="mpm_common"><name>MaxRequestsPerChild</name>
86 </directivesynopsis>
87 <directivesynopsis location="mpm_common"><name>ScoreBoardFile</name>
88 </directivesynopsis>
89 <directivesynopsis location="mpm_common"><name>SendBufferSize</name>
90 </directivesynopsis>
91 <directivesynopsis location="mpm_common"><name>ServerLimit</name>
92 </directivesynopsis>
93 <directivesynopsis location="mpm_common"><name>StartServers</name>
94 </directivesynopsis>
95 <directivesynopsis location="mpm_common"><name>User</name>
96 </directivesynopsis>
97 <directivesynopsis location="mpm_common"><name>Group</name>
98 </directivesynopsis>
99 <directivesynopsis location="mpm_common"><name>AcceptMutex</name>
100 </directivesynopsis>
101
102 <directivesynopsis>
103 <name>MaxSpareServers</name>
104 <description>Maximum number of idle child server processes</description>
105 <syntax>MaxSpareServers <var>number</var><br /></syntax>
106 <default>MaxSpareServers 10</default>
107 <contextlist><context>server config</context></contextlist>
108
109 <usage>
110     <p>The <directive>MaxSpareServers</directive> directive sets the
111     desired maximum number of <em>idle</em> child server processes. An
112     idle process is one which is not handling a request. If there are
113     more than <directive>MaxSpareServers</directive> idle, then the
114     parent process will kill off the excess processes.</p>
115
116     <p>Tuning of this parameter should only be necessary on very
117     busy sites. Setting this parameter to a large number is almost
118     always a bad idea. If you are trying to set the value lower than
119     <directive module="prefork">MinSpareServers</directive>, Apache
120     will automatically adjust it to <directive
121     >MinSpareServers</directive><code> + 1</code>.</p>
122 </usage>
123 <seealso><directive module="prefork">MinSpareServers</directive></seealso>
124 <seealso><directive module="mpm_common">StartServers</directive></seealso>
125 </directivesynopsis>
126
127 <directivesynopsis>
128 <name>MinSpareServers</name>
129 <description>Minimum number of idle child server processes</description>
130 <syntax>MinSpareServers <var>number</var></syntax>
131 <default>MinSpareServers 5</default>
132 <contextlist><context>server config</context></contextlist>
133
134 <usage>
135     <p>The <directive>MinSpareServers</directive> directive sets the
136     desired minimum number of <em>idle</em> child server processes. An
137     idle process is one which is not handling a request. If there are
138     fewer than <directive>MinSpareServers</directive> idle, then the parent
139     process creates new children at a maximum rate of 1 per second.</p>
140
141     <p>Tuning of this parameter should only be necessary on very
142     busy sites. Setting this parameter to a large number is almost
143     always a bad idea.</p>
144 </usage>
145 <seealso><directive module="prefork">MaxSpareServers</directive></seealso>
146 <seealso><directive module="mpm_common">StartServers</directive></seealso>
147 </directivesynopsis>
148
149 </modulesynopsis>
150