| <?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: 420990:1137744 (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>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>ReceiveBufferSize</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> |
| |