blob: 04dd8808564b2126855768397f7077d14e9a2718 [file] [log] [blame]
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE manualpage SYSTEM "./style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.zh-cn.xsl"?>
<!-- English revision : 421100 -->
<!--
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.
-->
<manualpage metafile="mpm.xml.meta">
<title>多处理模块(MPM)</title>
<summary>
<p>本文档介绍了什么是多处理模块,以及 Apache HTTP 服务器如何使用它们。</p>
</summary>
<section id="introduction"><title>介绍</title>
<p>Apache HTTP 服务器被设计为一个功能强大,并且灵活的 web 服务器,
可以在很多平台与环境中工作。不同平台和不同的环境往往需要不同
的特性,或可能以不同的方式实现相同的特性最有效率。Apache
通过模块化的设计来适应各种环境。这种设计允许网站管理员通过在
编译时或运行时,选择哪些模块将会加载在服务器中,来选择服务器特性。</p>
<p>Apache 2.0 扩展此模块化设计到最基本的 web 服务器功能。
它提供了可以选择的多处理模块(MPM),用来绑定到网络端口上,接受请求,
以及调度子进程处理请求。</p>
<p>扩展到这一级别的服务器模块化设计,带来两个重要的好处:</p>
<ul>
<li>Apache 能更优雅,更高效率的支持不同的平台。尤其是
Apache 的 Windows 版本现在更有效率了,因为
<module>mpm_winnt</module> 能使用原生网络特性取代在
Apache 1.3 中使用的 POSIX 层。它也可以扩展到其它平台
来使用专用的 MPM。</li>
<li>Apache 能更好的为有特殊要求的站点定制。例如,要求
更高伸缩性的站点可以选择使用线程的 MPM,即
<module>worker</module><module>event</module>
需要可靠性或者与旧软件兼容的站点可以使用
<module>prefork</module></li>
</ul>
<p>在用户看来,MPM 很像其它 Apache 模块。主要是区别是,在任何时间,
必须有一个,而且只有一个 MPM 加载到服务器中。可用的 MPM 列表位于
<a href="mod/">模块索引页面</a></p>
</section>
<section id="choosing"><title>选择 MPM</title>
<p>MPM 必须在编译前夕,配置时指定,然后编译到服务器程序中。
仅当编译器知道使用了线程时,它才有能力优化许多函数。</p>
<p>为了使用指定的 MPM,请在执行 <program>configure</program>
时,使用参数 <code>--with-mpm=<em>NAME</em></code><em>NAME</em>
是指定的 MPM 名称。</p>
<p>编译完成后,可以使用 <code>./httpd -l</code> 来确定选择的 MPM。
此命令会列出编译到服务器程序中的所有模块,包括 MPM。</p>
</section>
<section id="defaults"><title>默认 MPM</title>
<p>下表列出了不同系统的默认 MPM。如果你不在编译时选择,那么它就是你将要使用的 MPM。</p>
<table>
<columnspec><column width=".2"/><column width=".2"/></columnspec>
<tr><td>BeOS</td><td><module>beos</module></td></tr>
<tr><td>Netware</td><td><module>mpm_netware</module></td></tr>
<tr><td>OS/2</td><td><module>mpmt_os2</module></td></tr>
<tr><td>Unix</td><td><module>prefork</module></td></tr>
<tr><td>Windows</td><td><module>mpm_winnt</module></td></tr>
</table>
</section>
</manualpage>