summaryrefslogtreecommitdiff
path: root/docs/manual/mod/prefork.xml.ja
blob: 339adab80de906cac41909258a876e6297e82d9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.ja.xsl"?>
<!-- English Revision: 151405:421174 (outdated) -->

<!--
 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="prefork.xml.meta">

<name>prefork</name>
<description>スレッドを使わず、先行して fork を行なうウェブサーバを実装
</description>
<status>MPM</status>
<sourcefile>prefork.c</sourcefile>
<identifier>mpm_prefork_module</identifier>

<summary>
    <p>このマルチプロセッシングモジュール (MPM) は、
    Unix 上での Apache 1.3 のデフォルトの挙動と非常によく似た方法で
    リクエストを処理する、スレッドを使わず、先行して fork を行なう
    ウェブサーバを実装しています。
    スレッドセーフでないライブラリとの互換性をとるために、
    スレッドを避ける必要のあるサイトでは、このモジュールの使用が適切でしょう。
    あるリクエストで発生した問題が他のリクエストに影響しないように、
    個々のリクエストを単離するのにも、最適な MPM です。</p>

    <p>この MPM は非常に自律的なので、この MPM の設定ディレクティブを
    調整する必要はほとんどないでしょう。もっとも重要なことは、
    <directive module="mpm_common">MaxClients</directive>
    が、予想される同時リクエスト数を十分扱えるぐらいは大きいけれども、
    全プロセスに十分な物理メモリが確実に行き渡る程度には小さい値にする、
    ということです。</p>

</summary>
<seealso><a href="../bind.html">Apache
が使用するアドレスとポートの設定</a></seealso>

<section id="how-it-works"><title>動作方法</title>
    <p>一つのコントロールプロセスが、
    コネクションに対して listen して、しかるべき時に応答する
    子プロセスを起動します。Apache は常に幾つかの<dfn>スペア</dfn>
    かアイドルなサーバプロセスを維持していて、それらは入ってきた
    リクエストに応答できるように待機しています。
    このようにしてクライアントは、リクエストが応答される前に、
    新しい子プロセスが fork されるのを待たなくてもよいように
    なっています。</p>

    <p>親プロセスがリクエストに応答するの子プロセスを
    どのように生成するかは、
    <directive module="mpm_common">StartServers</directive>,
    <directive module="prefork">MinSpareServers</directive>,
    <directive module="prefork">MaxSpareServers</directive>,
    <directive module="mpm_common">MaxClients</directive>
    で調整します。一般的に、Apache は非常に自律的なので、
    大抵のサイトではこれらのディレクティブをデフォルト値から調整する
    必要はないでしょう。
    同時に 256 を超えるリクエストに応答しないといけないサイトでは、
    <directive module="mpm_common">MaxClients</directive>
    を増やす必要があるでしょう。
    一方、メモリの限られているサイトでは、スラッシング
    (メモリとディスク間で何度もスワップ) が起こるのを防ぐために
    <directive module="mpm_common">MaxClients</directive>
    を減らす必要があるでしょう。プロセス生成のチューニングに関する
    詳しい情報は、<a 
    href="../misc/perf-tuning.html">性能に関するヒント</a>
    にあります。</p>

    <p>通常 Unix では親プロセスは 80 番ポートにバインドするために
    <code>root</code> で起動されますが、子プロセスやスレッドは
    もっと低い権限のユーザで Apache によって起動されます。
    <directive module="mpm_common">User</directive> と
    <directive module="mpm_common">Group</directive>
    ディレクティブは
    Apache の子プロセスの権限を設定するのに用いられます。
    子プロセスはクライアントに送るコンテンツ全てを読めないといけませんが、
    可能な限り必要最小限の権限のみを持っているようにするべきです。</p>

    <p><directive module="mpm_common">MaxRequestsPerChild</directive>
    は、古いプロセスを停止して新しいプロセスを起動することによって、
    どの程度の頻度でサーバがプロセスをリサイクルするかを制御します。</p>
</section>

<directivesynopsis location="mpm_common"><name>BS2000Account</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>CoreDumpDirectory</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>EnableExceptionHook</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>PidFile</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>Listen</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>ListenBacklog</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>LockFile</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>MaxClients</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>MaxMemFree</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>MaxRequestsPerChild</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>ScoreBoardFile</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>SendBufferSize</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>ServerLimit</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>StartServers</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>User</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>Group</name>
</directivesynopsis>
<directivesynopsis location="mpm_common"><name>AcceptMutex</name>
</directivesynopsis>

<directivesynopsis>
<name>MaxSpareServers</name>
<description>アイドルな子サーバプロセスの最大個数</description>
<syntax>MaxSpareServers <var>number</var></syntax>
<default>MaxSpareServers 10</default>
<contextlist><context>server config</context></contextlist>

<usage>
    <p><directive>MaxSpareServers</directive> ディレクティブは、
    <em>アイドルな</em>子サーバプロセスの希望最大個数を設定します。
    アイドルプロセスとは、リクエストを扱っていないプロセスです。
    <directive>MaxSpareServers</directive> よりも多い数がアイドルであれば、
    親プロセスは超過プロセスを kill します。</p>

    <p>非常に混んでいるサイトでのみ、このパラメータをチューニングするべきです。
    このパラメータを大きくするということは、大抵の場合は悪い発想です。
    <directive module="prefork">MinSpareServers</directive>
    よりも小さい値に設定した場合、<directive>MinSpareServers</directive>
    <code>+1</code> に自動調整されます。</p>
</usage>
<seealso><directive module="prefork">MinSpareServers</directive></seealso>
<seealso><directive module="mpm_common">StartServers</directive></seealso>
</directivesynopsis>

<directivesynopsis>
<name>MinSpareServers</name>
<description>アイドルな子サーバプロセスの最小個数</description>
<syntax>MinSpareServers <var>number</var></syntax>
<default>MinSpareServers 5</default>
<contextlist><context>server config</context></contextlist>

<usage>
    <p><directive>MaxSpareServers</directive> ディレクティブは、
    <em>アイドルな</em>子サーバプロセスの希望最小個数を設定します。
    アイドルプロセスとは、リクエストを扱っていないプロセスです。
    <directive>MinSpareServers</directive> よりも少ない数がアイドルであれば、
    親プロセスは最高で 1 秒につき 1 個の割合で新しい子プロセスを生成します。</p>

    <p>非常に混んでいるサイトでのみ、このパラメータをチューニングするべきです。
    このパラメータを大きくするということは、大抵の場合は悪い発想です。</p>
</usage>
<seealso><directive module="prefork">MaxSpareServers</directive></seealso>
<seealso><directive module="mpm_common">StartServers</directive></seealso>
</directivesynopsis>

</modulesynopsis>