home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2004 November
/
CMCD1104.ISO
/
Software
/
Complet
/
Apache
/
apache_2.0.52-win32-x86-no_ssl.msi
/
Data.Cab
/
F277923_perftuning.xml.ko
< prev
next >
Wrap
Extensible Markup Language
|
2004-05-07
|
41KB
|
1,042 lines
<?xml version="1.0" encoding="EUC-KR" ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.ko.xsl"?>
<!-- English Revision: 1.3.2.15 -->
<!--
Copyright 2004 The Apache Software Foundation
Licensed 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="perf-tuning.xml.meta">
<parentdocument href="./">Miscellaneous Documentation</parentdocument>
<title>╛╞╞──í ╝║┤╔╟Γ╗≤</title>
<summary>
<p>╛╞╞──í 2.0└║ ▒Γ┤╔░· ╞≈╞├░í┤╔╝║░· ╝║┤╔└╟ ▒╒╟ⁿ└╠ ╕┬╡╡╖╧
╝│░Φ╟╤ ╣ⁿ┐δ └Ñ╝¡╣÷└╠┤┘. ║Ñ─í╕╢┼⌐ ▒Γ╖╧└╗ ╝╝┐∞▒Γ└º╟╪ ╝│░Φ╟╧┴÷
╛╩╛╥┴÷╕╕ ╛╞╞──í 2.0└║ ╜╟┴ª ╕╣└║ ░µ┐∞ │⌠└║ ╝║┤╔└╗ │╜┤┘.</p>
<p>╛╞╞──í 1.3░· ║±▒│╟╪╝¡ 2.0 ╣÷└ⁿ└║ ├│╕«╖«░· ╚«└σ╝║(scalability)└╗
│⌠└╠▒Γ└º╟╪ ╕╣└║ ├╓└√╚¡╕ª ╟▀┤┘. ▒Γ║╗░¬└╕╖╬ ┤δ║╬║╨ ├╓└√╚¡╟╤
░¬└╗ ╗τ┐δ╟╤┤┘. ▒╫╖»│¬ ──╞─└╧╜├ ╚ñ└║ ╜╟╟α╜├ ╝│┴ñ└╠ ╝║┤╔┐í
┼½ ┐╡╟Γ└╗ ┴┘ ╝÷ └╓┤┘. └╠ ╣«╝¡┤┬ ╛╞╞──í 2.0└╟ ╝║┤╔└╗ ╟Γ╗≤╟╧▒Γ└º╟╪
╝¡╣÷ ░ⁿ╕«└┌░í ╝│┴ñ╟╥ ╝÷ └╓┤┬ ┐╔╝╟└╗ ╝│╕φ╟╤┤┘. ╛ε╢▓ ╝│┴ñ
┐╔╝╟└║ └Ñ╝¡╣÷░í ╟╧╡σ┐■╛ε┐═ ┐ε┐╡├╝┴ª└╟ ▒Γ┤╔└╗ ┤⌡ └▀ ╚░┐δ╟╧╡╡╖╧
╟╧┤┬ ╣▌╕Θ, ╛ε╢▓ ┐╔╝╟└║ ╝╙╡╡╕ª └º╟╪ ▒Γ┤╔└╗ ╚±╗²╟╤┤┘.</p>
</summary>
<section id="hardware">
<title>╟╧╡σ┐■╛ε┐═ ┐ε┐╡├╝┴ª┐í ┤δ╟╪╝¡</title>
<p>└Ñ╝¡╣÷ ╝║┤╔┐í ░í└σ ┼½ ┐╡╟Γ└╗ ┴╓┤┬ ░═└║ ╕▐╕≡╕«┤┘. ╜║┐╥└║
┐Σ├╗┤τ ┴÷┐¼╜├░ú└╗ ╗τ┐δ└┌░í "├µ║╨╚≈ ║ⁿ╕ú┤┘░φ" ╗²░ó╟╧┴÷ ╕°╟╧░╘
┤├╕«▒Γ╢º╣«┐í └Ñ╝¡╣÷┤┬ ╜║┐╥└╗ ╟╧╕Θ ╛╚╡╚┤┘. ┤└╖┴┴÷╕Θ ╗τ┐δ└┌┤┬
┴ñ┴÷╟╧░φ ┤┘╜├ ┴ó╝╙╟╧┐⌐ ║╬╟╧░í ░Φ╝╙ ┴⌡░í╟╤┤┘. <directive
module="mpm_common">MaxClients</directive> ┴÷╜├╛ε╕ª ┴╢└²╟╧┐⌐
└Ñ╝¡╣÷░í ╜║┐╥└╗ ╟╥ ┴ñ╡╡╖╬ ╕╣└║ └┌╜─└╗ ╕╕╡Θ┴÷╛╩╡╡╖╧ ╟╪╛▀
╟╤┤┘. ╣µ╣²└║ ░ú┤▄╟╧┤┘: <code>top</code>░· ░░└║ ╡╡▒╕┐í╝¡
╟┴╖╬╝╝╜║ ╕±╖╧└╗ ║╕░φ ╛╞╞──í ╟┴╖╬╝╝╜║└╟ ╞≥▒╒ ╕▐╕≡╕« ╗τ┐δ╖«└╗
╛╦╛╞│╜╚─, └ⁿ├╝ ╗τ┐δ░í┤╔╟╤ ╕▐╕≡╕«┐í╝¡ ┤┘╕Ñ ╟┴╖╬╝╝╜║╡Θ└╠ ╗τ┐δ╟╥
░°░ú└╗ ╗½ ░¬┐í╝¡ │¬┤½┤┘.</p>
<p>│¬╕╙┴÷┤┬ ╞≥╣ⁿ╟╧┤┘: ├µ║╨╚≈ ║ⁿ╕Ñ CPU, ├µ║╨╚≈ ║ⁿ╕Ñ │╫╞«┐≈─½╡σ,
├µ║╨╚≈ ║ⁿ╕Ñ ╡≡╜║┼⌐, ┐⌐▒Γ╝¡ "├µ║╨╚≈ ║ⁿ╕Ñ"└║ ╜╟╟Φ└╗ ╟╪╝¡ ░ß┴ñ╟╪╛▀
╟╤┤┘.</p>
<p>┐ε┐╡├╝┴ª┤┬ ║╕┼δ ░ó└┌ ╛╦╛╞╝¡ ╝▒┼├╟╥ └╧└╠┤┘. ▒╫╖»│¬ └╧╣▌└√└╕╖╬
└»┐δ╟╧┤┘░φ ╞╟╕φ╡╚ ╕ε░í┴÷ ┴÷─º└╠ └╓┤┘:</p>
<ul>
<li>
<p>╝▒┼├╟╤ ┐ε┐╡├╝┴ª└╟ ├╓╜┼ ╛╚┴ñ ╣÷└ⁿ░· ╞╨─í╕ª ╜╟╟α╟╤┤┘.
╕╣└║ ┐ε┐╡├╝┴ª ┴ª└█╗τ┤┬ ├╓▒┘ TCP ╜║┼├░· ╛▓╖╣╡σ ╢≤└╠║Ω╖»╕«┐í
╕╣└║ ╝╙╡╡╟Γ╗≤└╗ ╟▀┤┘.</p>
</li>
<li>
<p>┐ε┐╡├╝┴ª░í <code>sendfile(2)</code> ╜├╜║┼█╚ú├Γ└╗
┴÷┐°╟╤┤┘╕Θ, └╠╕ª ╗τ┐δ╟╧▒Γ└º╟╤ ╣÷└ⁿ└╠│¬ ╞╨─í╕ª ╝│─í╟╧┐┤┤┬┴÷
╚«└╬╟╤┤┘. (┐╣╕ª ╡Θ╛ε, ╕«┤¬╜║╢≤╕Θ 2.4 └╠╗≤ ╣÷└ⁿ└╗ ╢µ╟╤┤┘.
Solaris 8 ├╩▒Γ ╣÷└ⁿ└║ ╞╨─í░í ╟╩┐Σ╟╧┤┘.) ┴÷┐°╟╧┤┬ ╜├╜║┼█└╠╢≤╕Θ
╛╞╞──í 2┤┬ <code>sendfile</code>└╗ ╗τ┐δ╟╧┐⌐ CPU╕ª ┤·
╗τ┐δ╟╧╕τ ┴ñ└√ ╞─└╧└╗ ┤⌡ ╗í╕« └ⁿ╝█╟╥ ╝÷ └╒┤┘.</p>
</li>
</ul>
</section>
<section id="runtime">
<title>╜╟╟α╜├ ╝│┴ñ┐í ┤δ╟╪╝¡</title>
<related>
<modulelist>
<module>mod_dir</module>
<module>mpm_common</module>
<module>mod_status</module>
</modulelist>
<directivelist>
<directive module="core">AllowOverride</directive>
<directive module="mod_dir">DirectoryIndex</directive>
<directive module="core">HostnameLookups</directive>
<directive module="core">EnableMMAP</directive>
<directive module="core">EnableSendfile</directive>
<directive module="core">KeepAliveTimeout</directive>
<directive module="prefork">MaxSpareServers</directive>
<directive module="prefork">MinSpareServers</directive>
<directive module="core">Options</directive>
<directive module="mpm_common">StartServers</directive>
</directivelist>
</related>
<section id="dns">
<title>HostnameLookups┐═ DNS┐í ┤δ╟╪ ░φ╖┴╟╥ ┴í╡Θ</title>
<p>╛╞╞──í 1.3 └╠└ⁿ┐í <directive
module="core">HostnameLookups</directive>└╟ ▒Γ║╗░¬└║
<code>On</code>└╠┐┤┤┘. ┐Σ├╗└╗ ╕╢─í▒Γ└ⁿ┐í DNS ░╦╗÷└╠ │í│¬╛▀
╟╧╣╟╖╬ ┐Σ├╗╕╢┤┘ ┴÷┐¼└╠ ╗²░σ┤┘. ╛╞╞──í 1.3┐í╝¡ └╠ ╝│┴ñ└╟
▒Γ║╗░¬└╠ <code>Off</code>╖╬ ║»░µ╡╟╛·┤┘. ╖╬▒╫╞─└╧└╟ ┴╓╝╥╕ª
╚ú╜║╞«╕φ└╕╖╬ ║»╚»╟╧╖┴╕Θ ┐⌐╖» ╖╬▒╫├│╕« ╟┴╖╬▒╫╖Ñ┴▀ ╟╧│¬└╬,
╛╞╞──í┐í ╞≈╟╘╡╚ <a
href="../programs/logresolve.html"><code>logresolve</code></a>
╟┴╖╬▒╫╖Ñ└╗ ╗τ┐δ╟╧╢≤.</p>
<p>╖╬▒╫├│╕« └█╛≈└╠ ╝¡╣÷ ╝║┤╔┐í ╛╟┐╡╟Γ└╗ ╣╠─í╣╟╖╬ ╜╟┴ª
╗τ┐δ╟╧┤┬ └Ñ╝¡╣÷░í ╛╞┤╤ ┤┘╕Ñ ──╟╗┼═┐í╝¡ ╖╬▒╫╞─└╧└╗ ╚─├│╕«╟╧▒µ
╣┘╢⌡┤┘.</p>
<p><code><directive module="mod_access">Allow</directive>
from domain</code>└╠│¬ <code><directive
module="mod_access">Deny</directive> from domain</code>
┴÷╜├╛ε╕ª ╗τ┐δ╟╤┤┘╕Θ (┴∩, IP ┴╓╝╥░í ╛╞┤╤ ╚ú╜║╞«╕φ└╠│¬ ╡╡╕▐└╬╕φ└╗
╗τ┐δ╟╤┤┘╕Θ) ║╬╡µ└╠ ┴▀║╣-┐¬ DNS ░╦╗÷└╗ (┐¬░╦╗÷└╗ ╟╤╚─ ╛╟└╟╖╬
║»░µ╡╟╛·┤┬┴÷ ╚«└╬╟╧▒Γ└º╟╪ ┤┘╜├ ░╦╗÷) ╟╪╛▀ ╟╤┤┘. ▒╫╖»╣╟╖╬
╝║┤╔└╗ │⌠└╠▒Γ└º╟╪ └╠╖▒ ┴÷╜├╛ε┐í┤┬ ░í┤╔╟╧╕Θ └╠╕º┤δ╜┼ IP
┴╓╝╥╕ª ╗τ┐δ╟╤┤┘.</p>
<p><code><Location /server-status></code> ╝╜╝╟ ╡ε└╕╖╬
┴÷╜├╛ε└╟ └√┐δ╣ⁿ└º╕ª ┴ª╟╤╟╥ ╝÷ └╓└╜└╗ ▒Γ╛∩╟╧╢≤. └╠ ░µ┐∞
┴╢░╟┐í ╕┬┤┬ ┐Σ├╗┐í╕╕ DNS ┴╢╚╕╕ª ╟╤┤┘. ┤┘└╜└║
<code>.html</code>░· <code>.cgi</code> ╞─└╧╕╕ DNS ░╦╗÷└╗
╟╧┤┬ ┐╣┴ª┤┘:</p>
<example>
HostnameLookups off<br />
<Files ~ "\.(html|cgi)$"><br />
<indent>
HostnameLookups on<br />
</indent>
</Files>
</example>
<p>▒╫╖»│¬ CGI┐í╝¡ DNS╕φ└╠ ╟╩┐Σ╟╥ ╗╙└╠╢≤╕Θ, ╟╩┐Σ╟╤ ╞»┴ñ
CGI┐í╝¡╕╕ <code>gethostbyname</code> ╚ú├Γ└╗ ╟╧╡╡╖╧ ░φ╖┴╟╪║╝
╝÷ └╓┤┘.</p>
</section>
<section id="symlinks">
<title>FollowSymLinks┐═ SymLinksIfOwnerMatch</title>
<p>URL ░°░ú┐í╝¡ <code>Options FollowSymLinks</code>╕ª
╗τ┐δ╟╧┴÷╛╩░φ <code>Options SymLinksIfOwnerMatch</code>╕ª
╗τ┐δ╟╧╕Θ ╛╞╞──í┤┬ ╜╔║╝╕╡┼⌐╕ª ░╦╗τ╟╧▒Γ└º╟╪ ╜├╜║┼█╚ú├Γ└╗
╟╤╣° ┤⌡ ╟╪╛▀ ╟╤┤┘. ╞─└╧╕φ└╟ ░ó ║╬║╨╕╢┤┘ ╟╤╣°╛┐ ┤⌡ ╚ú├Γ└╗
╟╤┤┘. ┐╣╕ª ╡Θ╛ε, ╝│┴ñ└╠ ┤┘└╜░· ░░░φ:</p>
<example>
DocumentRoot /www/htdocs<br />
<Directory /><br />
<indent>
Options SymLinksIfOwnerMatch<br />
</indent>
</Directory>
</example>
<p><code>/index.html</code> URI┐í ┤δ╟╤ ┐Σ├╗└╠ └╓┤┘░φ ░í┴ñ╟╧└┌.
▒╫╖»╕Θ ╛╞╞──í┤┬ <code>/www</code>, <code>/www/htdocs</code>,
<code>/www/htdocs/index.html</code> ░ó░ó┐í ┤δ╟╪
<code>lstat(2)</code>╕ª ╚ú├Γ╟╤┤┘. <code>lstats</code>
░ß░·╕ª ─│╜╠╟╧┴÷ ╛╩▒Γ╢º╣«┐í ┐Σ├╗└╠ ╡Θ╛ε┐├ ╢º╕╢┤┘ ╕┼╣° ░░└║
└█╛≈└╗ ╟╤┤┘. ┴°┬Ñ ╜╔║╝╕╡┼⌐ ║╕╛╚ ░╦╗τ╕ª ┐°╟╤┤┘╕Θ ┤┘└╜░·
░░└╠ ╟╥ ╝÷ └╓┤┘:</p>
<example>
DocumentRoot /www/htdocs<br />
<Directory /><br />
<indent>
Options FollowSymLinks<br />
</indent>
</Directory><br />
<br />
<Directory /www/htdocs><br />
<indent>
Options -FollowSymLinks +SymLinksIfOwnerMatch<br />
</indent>
</Directory>
</example>
<p>└╠ ░µ┐∞ ├╓╝╥╟╤ <directive
module="core">DocumentRoot</directive> ░µ╖╬┤┬ ░╦╗τ╟╧┴÷
╛╩┤┬┤┘. DocumentRoot ╣█┐í └╓┤┬ ░µ╖╬╖╬ <directive
module="mod_alias">Alias</directive>│¬ <directive
module="mod_rewrite">RewriteRule</directive>└╗ ╗τ┐δ╟╤
░µ┐∞┐í╡╡ └º┐═ ║±╜┴╟╤ ╝╜╝╟└╠ ╟╩┐Σ╟╧┤┘. ╜╔║╝╕╡┼⌐ ║╕╛╚└╗
░φ╖┴╟╧┴÷ ╛╩░φ ├╓░φ└╟ ╝║┤╔└╗ ╛≥└╕╖┴╕Θ,
<code>FollowSymLinks</code>╕ª ╝│┴ñ╟╧░φ,
<code>SymLinksIfOwnerMatch</code>┤┬ └²┤δ╖╬ ╛╚╡╚┤┘.</p>
</section>
<section id="htacess">
<title>AllowOverride</title>
<p>URL ░°░ú┐í╝¡ overrides╕ª ╟π┐δ╟╤┤┘╕Θ (║╕┼δ
<code>.htaccess</code> ╞─└╧) ╛╞╞──í┤┬ ╞─└╧╕φ└╟ ░ó ║╬║╨╕╢┤┘
<code>.htaccess</code>╕ª ┐¡▒µ ╜├╡╡╟╤┤┘. ┐╣╕ª ╡Θ╛ε,</p>
<example>
DocumentRoot /www/htdocs<br />
<Directory /><br />
<indent>
AllowOverride all<br />
</indent>
</Directory>
</example>
<p><code>/index.html</code> URI┐í ┤δ╟╤ ┐Σ├╗└╠ └╓┤┘░φ ░í┴ñ╟╧└┌.
╛╞╞──í┤┬ <code>/.htaccess</code>, <code>/www/.htaccess</code>,
<code>/www/htdocs/.htaccess</code>╕ª ┐¡╖┴░φ ╜├╡╡╟╤┤┘.
╟╪░ß├Ñ└║ ╛╒└╟ <code>Options FollowSymLinks</code> ░µ┐∞┐═
║±╜┴╟╧┤┘. ├╓░φ└╟ ╝║┤╔└╗ ╛≥└╕╖┴╕Θ ╞─└╧╜├╜║┼█┐í ┤δ╟╪╝¡ ╟╫╗≤
<code>AllowOverride None</code>└╗ ╗τ┐δ╟╤┤┘.</p>
</section>
<section id="negotiation">
<title>│╗┐δ╟∙╗≤</title>
<p>░í┤╔╟╧░φ ┴°┬Ñ ┴╢▒▌└╟ ╝║┤╔╟Γ╗≤┐í╡╡ ░ⁿ╜╔└╠ └╓┤┘╕Θ │╗┐δ╟∙╗≤└╗
╕╖┤┬┤┘. ╜╟┴ª╖╬ ╟∙╗≤└╟ └╠╡µ└║ ╝║┤╔└·╟╧║╕┤┘ └█┤┘. ╝¡╣÷╕ª
║ⁿ╕ú░╘ ╟╥ ╝÷ └╓┤┘. ┤┘└╜░· ░░└╠ ┐═└╧╡σ─½╡σ╕ª ╗τ┐δ╟╧┤┬ ┤δ╜┼:</p>
<example>
DirectoryIndex index
</example>
<p>┐╧└ⁿ╟╤ ╕±╖╧└╗ ╗τ┐δ╟╤┤┘:</p>
<example>
DirectoryIndex index.cgi index.pl index.shtml index.html
</example>
<p>░í└σ ╚τ╟╤ ░═└╗ ╛╒┐í ╡╨┤┘.</p>
<p>╢╟, ╡≡╖║┼Σ╕«┐í╝¡ ╞─└╧╡Θ└╗ ├ú┤┬ <code>MultiViews</code>
║╕┤┘┤┬, ╟╤ ╞─└╧╕╕ └╨└╕╕Θ ╟╩┐Σ╟╤ ┴ñ║╕╕ª ╛≥└╗ ╝÷ └╓┤┬
<code>type-map</code> ╞─└╧└╗ ┴≈┴ó ╕╕╡σ┤┬ ░═└╠ ┤⌡ ║ⁿ╕º└╗
╕φ╜╔╟╧╢≤.</p>
<p>╗τ└╠╞«┐í │╗┐δ╟∙╗≤└╠ ╟╩┐Σ╟╧┤┘╕Θ ╟∙╗≤└╗ └º╟╪ <code>Options
MultiViews</code> ┴÷╜├╛ε╕ª ╗τ┐δ╟╧▒Γ║╕┤┘ <code>type-map</code>
╞─└╧└╗ ░φ╖┴╟╧╢≤. ╟∙╗≤╣µ╣²┐í ┤δ╟╤ └┌╝╝╟╤ ╝│╕φ░·
<code>type-map</code> ╞─└╧└╗ ╕╕╡σ┤┬ ╣µ╣²└║ <a
href="../content-negotiation.html">│╗┐δ╟∙╗≤</a> ╣«╝¡╕ª ┬ⁿ░φ╟╧╢≤.</p>
</section>
<section>
<title>╕▐╕≡╕«┤δ└└ (memory-mapping)</title>
<p>┐╣╕ª ╡Θ╛ε, server-side-include╕ª ├│╕«╟╧┤┬ ╡ε ╛╞╞──í
2.0└╠ └ⁿ╝█╟╥ ╞─└╧└╗ └╨└╗╢º ┐ε┐╡├╝┴ª░í <code>mmap(2)</code>
╡ε└╗ ┴÷┐°╟╤┤┘╕Θ ╞─└╧└╗ ╕▐╕≡╕«┤δ└└╟╤┤┘.</p>
<p>┐⌐╖» ╟├╖í╞√┐í╝¡ ╕▐╕≡╕«┤δ└└└╗ ╝║┤╔└╗ ╟Γ╗≤╟╤┤┘. ▒╫╖»│¬
╕▐╕≡╕«┤δ└└└╠ ╝¡╣÷└╟ ╝║┤╔└╗ ╢│╛ε╞«╕«░φ ╜╔┴÷╛ε ╛╚┴ñ╝║└╗
╟╪─í┤┬ ░µ┐∞░í └╓┤┘:</p>
<ul>
<li>
<p>╛ε╢▓ ┐ε┐╡├╝┴ª┐í╝¡ <code>mmap</code>└║ CPU ░│╝÷░í
╕╣╛╞┴·╢º <code>read(2)</code> ╕╕┼¡ ╚«└σ╝║└╠ ┴┴┴÷ ╛╩┤┘.
┐╣╕ª ╡Θ╛ε, ┤┘┴▀╟┴╖╬╝╝╝¡ Solaris ╝¡╣÷┐í╝¡ ╛╞╞──í 2.0└║
┴╛┴╛ <code>mmap</code>└╗ ╗τ┐δ╟╧┴÷ ╛╩└╗╢º ╝¡╣÷░í ├│╕«╟╤
╞─└╧└╗ ┤⌡ ╗í╕« └ⁿ╝█╟╤┤┘.</p>
</li>
<li>
<p>NFS ╕╢┐ε╞«╟╤ ╞─└╧╜├╜║┼█┐í └╓┤┬ ╞─└╧└╗ ╕▐╕≡╕«┤δ└└╟╧┤┬
╡╡┴▀┐í ┤┘╕Ñ NFS ┼¼╢≤└╠╛≡╞«┐í └╓┤┬ ╟┴╖╬╝╝╜║░í ╞─└╧└╗
┴÷┐∞░┼│¬ ╞─└╧┼⌐▒Γ╕ª ┴┘└╠╕Θ, └Ñ╝¡╣÷ ╟┴╖╬╝╝╜║░í ┤┘└╜
╣°┐í ╕▐╕≡╕«┤δ└└╟╤ ╞─└╧│╗┐δ└╗ └╨└╗╢º bus error░í ╣▀╗²╟╥
╝÷ └╓┤┘.</p>
</li>
</ul>
<p>└º└╟ ┴╢░╟┐í ╟╪┤τ╟╧╕Θ └ⁿ╝█╟╧┤┬ ╞─└╧└╗ ╕▐╕≡╕«┤δ└└╟╧┴÷
╛╩╡╡╖╧ <code>EnableMMAP off</code>╕ª ╗τ┐δ╟╪╛▀ ╟╤┤┘. (┴╓└╟:
└╠ ┴÷╜├╛ε┤┬ ╡≡╖║┼Σ╕«║░╖╬ ║»░µ╟╥ ╝÷ └╓┤┘.)</p>
</section>
<section>
<title>Sendfile</title>
<p>╛╞╞──í┤┬ ┐ε┐╡├╝┴ª░í <code>sendfile(2)</code>└╗ ┴÷┐°╟╧╕Θ
─┐│╬ sendfile└╗ ╗τ┐δ╟╧┐⌐ -- ┐╣╕ª ╡Θ╛ε, ┴ñ└√ ╞─└╧└╗ ╝¡║±╜║╟╥╢º
-- └ⁿ╝█╟╥ ╞─└╧└╗ ┴≈┴ó └╨┴÷╛╩└╗ ╝÷ └╓┤┘.</p>
<p>┐⌐╖» ╟├╖í╞√┐í╝¡ sendfile└╗ ╗τ┐δ╟╧╕Θ read┐═ send╕ª ╡√╖╬
╟╥ ╟╩┐Σ░í ╛°╛ε╝¡ ╗í╢≤┴°┤┘. ▒╫╖»│¬ sendfile└╗ ╗τ┐δ╟╧╕Θ
└Ñ╝¡╣÷└╟ ╛╚┴ñ╝║└╗ ╟╪─í░╘╡╟┤┬ ░µ┐∞░í └╓┤┘:</p>
<ul>
<li>
<p>sendfile ┴÷┐°└╠ └▀╕°╡╟╛·░φ ──╞─└╧ ╜├╜║┼█└╠ └╠┴í└╗
╣▀░▀╟╧┴÷ ╕°╟╧┤┬ ╟├╖í╞√└╠ └╓┤┘. ╞»╚≈ ┤┘╕Ñ ──╟╗┼═┐í╝¡
╜╟╟α╞─└╧└╗ ──╞─└╧╟╧┐⌐ sendfile ┴÷┐°└╠ └▀╕°╡╚ ──╟╗┼═╖╬
░í┴«┐┬ ░µ┐∞┐í ░í┤╔╟╧┤┘.</p>
</li>
<li>
<p>─┐│╬└║ └┌╜┼└╟ ─│╜¼╕ª ╗τ┐δ╟╧┐⌐ NFS╖╬ ╕╢┐ε╞«╟╤ ╞─└╧└╗
╛╚┴ñ└√└╕╖╬ ╝¡║±╜║╟╥ ╝÷ ╛°┤┬ ░µ┐∞░í └╓┤┘.</p>
</li>
</ul>
<p>└º└╟ ┴╢░╟┐í ╟╪┤τ╟╧╕Θ ╞─└╧└╗ sendfile └ⁿ╝█╟╧┴÷ ╛╩╡╡╖╧
<code>EnableSendfile off</code>╕ª ╗τ┐δ╟╪╛▀ ╟╤┤┘. (┴╓└╟:
└╠ ┴÷╜├╛ε┤┬ ╡≡╖║┼Σ╕«║░╖╬ ║»░µ╟╥ ╝÷ └╓┤┘.)</p>
</section>
<section id="process">
<title>╟┴╖╬╝╝╜║ ╗²╝║</title>
<p>╛╞╞──í 1.3 └╠└ⁿ┐í┤┬ <directive
module="prefork">MinSpareServers</directive>, <directive
module="prefork">MaxSpareServers</directive>, <directive
module="mpm_common">StartServers</directive> ╝│┴ñ└╠ ╕≡╡╬
║Ñ─í╕╢┼⌐ ░ß░·┐í ┼½ ┐╡╟Γ└╗ ╣╠├╞┤┘. ╞»╚≈ ╛╞╞──í┤┬ └█╛≈└╗
╝¡║±╜║╟╧▒Γ└º╟╪ ├µ║╨╟╤ └┌╜─╝÷┐í ┤┘┤┘╕ª ╢º▒ε┴÷ "╡╡┤▐" ▒Γ░ú└╠
╟╩┐Σ╟▀┤┘. ├│└╜ <directive
module="mpm_common">StartServers</directive>░│ └┌╜─└╗
╕╕╡τ╚─, <directive module="prefork">MinSpareServers</directive>
╝│┴ñ░¬▒ε┴÷ ├╩┤τ └┌╜─└╗ ╟╧│¬╛┐ ╕╕╡Θ╛·┤┘. ▒╫╖í╝¡ <directive
module="mpm_common">StartServers</directive> ▒Γ║╗░¬└╠
<code>5</code>└╬ ╝¡╣÷┐í ┼¼╢≤└╠╛≡╞« 100░│░í ╡┐╜├┐í ┴ó╝╙╟╧╕Θ
║╬╟╧╕ª ├│╕«╟╧▒Γ┐í ├µ║╨╟╤ └┌╜─└╗ ╕╕╡Θ▒Γ▒ε┴÷ 95├╩░í ░╔╖╚┤┘.
└┌┴╓ └τ╜├└█╟╧┴÷ ╛╩┤┬ ╜╟┴ª ╝¡╣÷┐í╝¡┤┬ └▀ ╡┐└█╟╧┴÷╕╕, 10║╨░ú╕╕
╜╟╟α╟╧┤┬ ║Ñ─í╕╢┼⌐ ░ß░·┤┬ ╕┼┐∞ │¬╗┌░╘ │¬┐┬┤┘.</p>
<p>├╩┤τ ╟╤░│ ▒╘─ó└║ └┌╜─└╗ ╗⌡╖╬ ╜├└█╟╧╕Θ╝¡ ╝¡╣÷┐í ╣½╕«╕ª
┴╓┴÷ ╛╩└╕╖┴░φ ┴ñ╟▀┤┘. ──╟╗┼═░í └┌╜─└╗ ╜├└█╟╧┤└╢≤ ╣┘╗┌╕Θ
┐Σ├╗└╗ ╝¡║±╜║╟╥ ╝÷ ╛°┤┘. ▒╫╖»│¬ └╠ ▒╘─ó└╠ ╛╞╞──í└╟ ├╝░¿
╝║┤╔┐í ╛╟┐╡╟Γ└╗ ┴╓╛ε ║»░µ╟╧┐┤┤┘. ╛╞╞──í 1.3┐í╝¡ ├╩┤τ ╟╤░│
▒╘─ó└║ ┐╧╚¡╡╟╛·┤┘. ─┌╡σ┤┬ └┌╜─ ╟╤░│╕ª ╕╕╡Θ░φ, 1├╩ ╜¼░φ,
╡╬░│╕ª ╕╕╡Θ░φ, 1├╩ ╜¼░φ, │╫░│╕ª ╕╕╡Θ░φ, └╠╖▒ ╜─└╕╖╬ ├╩┤τ
└┌╜─└╗ 32░│ ╕╕╡Θ╢º▒ε┴÷ ┴÷╝÷╖╬ ┴⌡░í╟╤┤┘. └┌╜─╝÷░í <directive
module="prefork">MinSpareServers</directive> ╝│┴ñ┐í ┤┘┤┘╕ú╕Θ
┴⌡░í╕ª ┴▀┤▄╟╤┤┘.</p>
<p>└╠ ░µ┐∞ ╣▌└└╝╙╡╡░í ╗í╢≤┴«╝¡ <directive module="prefork"
>MinSpareServers</directive>, <directive module="prefork"
>MaxSpareServers</directive>, <directive module="mpm_common"
>StartServers</directive>╕ª ░┼└╟ ╝│┴ñ╟╥ ╟╩┐Σ░í ╛°┤┘. └╧├╩┐í
└┌╜─└╗ 4░│ └╠╗≤ ╗²╝║╟╧╕Θ <directive
module="core">ErrorLog</directive>┐í ▒Γ╖╧╟╤┤┘. └╠╖▒ ┐└╖∙╣«└╠
╕╣└╠ ║╕└╠╕Θ └╠ ╝│┴ñ╡Θ└╗ ┴╢└²╟╧▒µ ╣┘╢⌡┤┘.
<module>mod_status</module> ░ß░·░í ╡╡┐≥└╠ ╡╔ ░═└╠┤┘.</p>
<p>╟┴╖╬╝╝╜║ ╗²╝║░· ░ⁿ╖├╟╧┐⌐ <directive
module="mpm_common">MaxRequestsPerChild</directive> ╝│┴ñ└║
╟┴╖╬╝╝╜║╕ª ┴╛╖ß╟╤┤┘. ▒Γ║╗░¬└║ └┌╜─┤τ ├│╕«╟╥ ┐Σ├╗╝÷┐í ┴ª╟╤└╠
╛°┤┘┤┬ <code>0</code>└╠┤┘. ╟÷└τ ╝│┴ñ└╠ <code>30</code>░·
░░└╠ ╕┼┐∞ └█└║ ░¬└╕╖╬ ╝│┴ñ╡╟└╓┤┘╕Θ, ░¬└╗ ╗≤┤τ╚≈ │⌠╚· ╟╩┐Σ░í
└╓┤┘. SunOS│¬ ┐└╖í╡╚ Solaris ╣÷└ⁿ└╗ ╗τ┐δ╟╤┤┘╕Θ, ╕▐╕≡╕«└»├Γ╢º╣«┐í
└╠ ░¬└╗ <code>10000</code> ┴ñ╡╡╖╬ ╝│┴ñ╟╧╢≤.</p>
<p>┐¼░ß└»┴÷(keep-alive)╕ª ╗τ┐δ╟╤┤┘╕Θ └┌╜─╡Θ└║ └╠╣╠ ┐¡╕░
┐¼░ß┐í╝¡ ├▀░í ┐Σ├╗└╗ ▒Γ┤┘╕«╕τ ╛╞╣½░═╡╡ ╟╧┴÷╛╩▒Γ╢º╣«┐í ░Φ╝╙
╣┘╗┌┤┘. <directive module="core">KeepAliveTimeout</directive>└╟
▒Γ║╗░¬ <code>15</code> ├╩┤┬ └╠╖▒ ╟÷╗≤└╗ ├╓╝╥╚¡╟╤┤┘. │╫╞«┐≈
┤δ┐¬╞°░· ╝¡╣÷ └┌┐° ░ú└╟ ▒╒╟ⁿ└╠ ╕┬░╘ ╝│┴ñ╟╤┤┘. <a
href="http://www.research.digital.com/wrl/techreports/abstracts/95.4.html">
┐¼░ß└»┴÷└╟ ┤δ║╬║╨└╟ └╠┴í└╠ ╗τ╢≤┴÷▒Γ╢º╣«┐í</a> ╛ε╢▓ ░µ┐∞┐í╡╡
└╠ ░¬└╗ <code>60</code> ├╩ └╠╗≤└╕╖╬ ┐├╕«┴÷ ╕╢╢≤.</p>
</section>
</section>
<section id="compiletime">
<title>──╞─└╧╜├ ╝│┴ñ┐í ┤δ╟╪╝¡</title>
<section>
<title>MPM ╝▒┼├</title>
<p>╛╞╞──í 2.x┤┬ <a href="../mpm.html">┤┘┴▀├│╕«╕≡╡Γ</a>
(MPMs)└╠╢≤┤┬ ▒│├╝╟╥ ╝÷ └╓┤┬ ╡┐▒Γ╚¡ ╕≡╡¿└╗ ┴÷┐°╟╤┤┘. ╛╞╞──í╕ª
──╞─└╧╟╥╢º MPM└╗ ╝▒┼├╟╪╛▀ ╟╤┤┘. <module>beos</module>,
<module>mpm_netware</module>, <module>mpmt_os2</module>,
<module>mpm_winnt</module>┐═ ░░└╠ ╞»┴ñ ╟├╖í╞√┐í╝¡╕╕ ╗τ┐δ╟╥
╝÷ └╓┤┬ MPM╡╡ └╓┤┘. └╧╣▌└√└╬ └»┤╨╜║╖∙ ╜├╜║┼█└║ ┐⌐╖» MPM
┴▀┐í ╟╧│¬╕ª ╝▒┼├╟╥ ╝÷ └╓┤┘. └Ñ╝¡╣÷└╟ ╝╙╡╡┐═
╚«└σ╝║(scalability)└║ ╛ε╢▓ MPM└╗ ╝▒┼├╟▀│─┐í ┤▐╖╚┤┘:</p>
<ul>
<li><module>worker</module> MPM└║ ┐⌐╖» └┌╜─ ╟┴╖╬╝╝╜║░í
░ó░ó ┐⌐╖» ╛▓╖╣╡σ╕ª ╗τ┐δ╟╤┤┘. ░ó ╛▓╖╣╡σ┤┬ ╟╤╣°┐í ╟╤ ┐¼░ß└╗
┤π┤τ╟╤┤┘. └╧╣▌└√└╕╖╬ worker┤┬ prefork MPM ║╕┤┘ └√└║
╕▐╕≡╕«╕ª ╗τ┐δ╟╧╣╟╖╬ ┼δ╜┼╖«└╠ ╕╣└║ ╝¡╣÷┐í └√└²╟╧┤┘.</li>
<li><module>prefork</module> MPM└║ ╛▓╖╣╡σ░í ╟╤░│└╬ └┌╜─
╟┴╖╬╝╝╜║╕ª ┐⌐╖»░│ ╗τ┐δ╟╤┤┘. ░ó ╟┴╖╬╝╝╜║┤┬ ╟╤╣°┐í ╟╤
┐¼░ß└╗ ┤π┤τ╟╤┤┘. ┐⌐╖» ╜├╜║┼█┐í╝¡ prefork└╟ ╝╙╡╡┤┬ worker┐═
║±╜┴╟╧┴÷╕╕, ┤⌡ ╕╣└║ ╕▐╕≡╕«╕ª ╗τ┐δ╟╤┤┘. ┤┘└╜░· ░░└║ ╗≤╚▓┐í╝¡
╛▓╖╣╡σ╕ª ╗τ┐δ╟╧┴÷ ╛╩┤┬ prefork ╣µ╜─└╠ worker┐í ║±╟╪
└╠┴í└╗ ░í┴°┤┘: ╛▓╖╣╡σ┐í ╛╚└ⁿ╟╧┴÷ (thread-safe) ╛╩└║
┴ª╗∩└┌░í ╕╕╡τ ╕≡╡Γ└╗ ╗τ┐δ╟╥ ╝÷ └╓░φ, ╛▓╖╣╡σ ╡≡╣÷▒δ ┴÷┐°└╠
║≤╛α╟╤ ╟├╖í╞√┐í╝¡ ╜▒░╘ ╡≡╣÷▒δ╟╥ ╝÷ └╓┤┘.</li>
</ul>
<p>└╠ MPM╡Θ░· ┤┘╕Ñ MPM┐í ┤δ╟╪ ┤⌡ └┌╝╝╟╤ ┴ñ║╕┤┬ MPM <a
href="../mpm.html">╣«╝¡</a>╕ª ┬ⁿ░φ╟╧▒µ ╣┘╢⌡┤┘.</p>
</section>
<section id="modules">
<title>╕≡╡Γ</title>
<p>╕▐╕≡╕« ╗τ┐δ╖«└╠ ╝║┤╔┐í╝¡ ░í└σ ┴▀┐Σ╟╤ ┐Σ└╬└╠▒Γ╢º╣«┐í
╜╟┴ª╖╬ ╗τ┐δ╟╧┴÷ ╛╩┤┬ ╕≡╡Γ└╗ ┴ª░┼╟╪║╕└┌. ╕≡╡Γ└╗ <a
href="../dso.html">DSO</a>╖╬ ──╞─└╧╟▀┤┘╕Θ ░ú┤▄╚≈ ▒╫
╕≡╡Γ┐í ┤δ╟╤ <directive
module="mod_so">LoadModule</directive> ┴÷╜├╛ε╕ª ┴╓╝«├│╕«╟╧╕Θ
╡╚┤┘. ▒╫╖í╝¡ ╕≡╡Γ└╗ ┴ª░┼╟╧░φ ╜╟╟α╟╧┐⌐ ╗τ└╠╞«░í ╕≡╡Γ╛°└╠╡╡
┴ñ╗≤└√└╕╖╬ ╡┐└█╟╧┤┬┴÷ ╗∞╞∞║╝ ╝÷ └╓┤┘.</p>
<p>╣▌┤δ╖╬ ╕≡╡Γ└╠ ╛╞╞──í ╜╟╟α╞─└╧┐í ┴ñ└√└╕╖╬ ╕╡┼⌐╡╟└╓┤┘╕Θ
┐°╟╧┴÷ ╛╩┤┬ ╕≡╡Γ└╗ ┴ª░┼╟╧▒Γ└º╟╪ ╛╞╞──í╕ª └τ──╞─└╧╟╪╛▀
╟╤┤┘.</p>
<p>┐⌐▒Γ╝¡ ┤τ┐¼╚≈ ╛ε╢▓ ╕≡╡Γ└╗ ╗τ┐δ╟╧░φ ╗τ┐δ╟╧┴÷ ╕╗┴÷
└╟╣«└╠ ╗²▒Σ┤┘. ┴ñ┤Σ└║ └Ñ╗τ└╠╞«╕╢┤┘ ┤┘╕ú┤┘. ▒╫╖»│¬ ╛╞╕╢╡╡
<em>├╓╝╥╟╤</em> <module>mod_mime</module>,
<module>mod_dir</module>, <module>mod_log_config</module>
╕≡╡Γ└║ ╗τ┐δ╟╥ ░═└╠┤┘. ╣░╖╨ └Ñ╗τ└╠╞«┐í ╖╬▒╫╞─└╧└╠ ╟╩┐Σ╛°┤┘╕Θ
<code>mod_log_config</code>┤┬ ╛°╛ε╡╡ ╡╚┤┘. ▒╫╖»│¬ ├▀├╡╟╧┴÷
╛╩┤┬┤┘.</p>
</section>
<section>
<title>Atomic ╕φ╖╔</title>
<p><module>mod_cache</module> ░░└║ ╕≡╡Γ░· ├╓▒┘ ░│╣▀┴▀└╬
worker MPM└║ APR└╟ atomic API╕ª ╗τ┐δ╟╤┤┘. └╠ API┤┬ ░µ╖«▒▐
╛▓╖╣╡σ ╡┐▒Γ╚¡╕ª └º╟╥ atomic ╕φ╖╔└╗ ┴ª░°╟╤┤┘.</p>
<p>▒Γ║╗└√└╕╖╬ APR└║ ░ó ┐ε┐╡├╝┴ª/CPU ╟├╖í╞√┐í╝¡ ░í└σ ╚┐└▓└√└╬
╣µ╣²└╗ ╗τ┐δ╟╧┐⌐ └╠ ╕φ╖╔└╗ ▒╕╟÷╟╤┤┘. ┐╣╕ª ╡Θ╛ε, ┐⌐╖» ├╓╜┼
CPU┐í┤┬ ╟╧╡σ┐■╛ε╖╬ atomic compare-and-swap (CAS) ┐¼╗Ω└╗
╟╧┤┬ ╕φ╖╔╛ε░í └╓┤┘. ▒╫╖»│¬ ╛ε╢▓ ╟├╖í╞√┐í╝¡ APR└║ └╠╖▒
╕φ╖╔╛ε░í ╛°┤┬ ┐└╖í╡╚ CPU┐═ ╚ú╚»╝║└╗ └º╟╪ ┤⌡ ┤└╕░ mutex▒Γ╣▌
▒╕╟÷└╗ ▒Γ║╗└√└╕╖╬ ╗τ┐δ╟╤┤┘. └╠╖▒ ╟├╖í╞√┐í╝¡ ╛╞╞──í╕ª
──╞─└╧╟╥╢º ╛╞╞──í╕ª ├╓╜┼ CPU┐í╝¡╕╕ ╜╟╟α╟╥ ░Φ╚╣└╠╢≤╕Θ,
╛╞╞──í╕ª ▒╕╝║╟╥╢º <code>--enable-nonportable-atomics</code>
┐╔╝╟└╗ ╗τ┐δ╟╧┐⌐ ┤⌡ ║ⁿ╕Ñ atomic ▒╕╟÷└╗ ╝▒┼├╟╥ ╝÷ └╓┤┘:</p>
<example>
./buildconf<br />
./configure --with-mpm=worker --enable-nonportable-atomics=yes
</example>
<p><code>--enable-nonportable-atomics</code> ┐╔╝╟└║ ┤┘└╜░·
░░└║ ╟├╖í╞√┐í ┐╡╟Γ└╠ └╓┤┘:</p>
<ul>
<li>SPARC┐í╝¡ Solaris<br />
▒Γ║╗└√└╕╖╬ APR└║ Solaris/SPARC┐í╝¡ mutex▒Γ╣▌ atomic└╗
╗τ┐δ╟╤┤┘. ▒╫╖»│¬ ▒╕╝║╟╥╢º
<code>--enable-nonportable-atomics</code>╕ª ╗τ┐δ╟╧╕Θ
APR└║ ║ⁿ╕Ñ ╟╧╡σ┐■╛ε compare-and-swap└╗ └º╟╤ SPARC
v8plus ╕φ╖╔╛ε╕ª ╗τ┐δ╟╤┤┘. └╠ ┐╔╝╟└╗ ╗τ┐δ╟╧╕Θ atomic
╕φ╖╔└╠ ┤⌡ ╚┐└▓└√└╠┴÷╕╕ (CPU╕ª ┤· ╗τ┐δ╟╧░φ ┤⌡ │⌠└║
╡┐▒Γ╚¡░í ░í┤╔╟╧┤┘), ──╞─└╧╟╤ ╜╟╟α╞─└╧└║ UltraSPARC
─¿┐í╝¡╕╕ ╜╟╟α╟╥ ╝÷ └╓┤┘.
</li>
<li>Linux on x86<br />
▒Γ║╗└√└╕╖╬ APR└║ ╕«┤¬╜║┐í╝¡ mutex▒Γ╣▌ atomic└╗
╗τ┐δ╟╤┤┘. ▒╫╖»│¬ ▒╕╝║╟╥╢º
<code>--enable-nonportable-atomics</code>╕ª ╗τ┐δ╟╧╕Θ
APR└║ ║ⁿ╕Ñ ╟╧╡σ┐■╛ε compare-and-swap└╗ └º╟╤ 486
╕φ╖╔╛ε╕ª ╗τ┐δ╟╤┤┘. ┤⌡ ╚┐└▓└√└╬ atomic ╕φ╖╔└╠ ░í┤╔╟╧┴÷╕╕,
──╞─└╧╟╤ ╜╟╟α╞─└╧└║ 486 └╠╗≤ ─¿┐í╝¡╕╕ (386└║ ╛╚╡╚┤┘)
╜╟╟α╟╥ ╝÷ └╓┤┘.
</li>
</ul>
</section>
<section>
<title>mod_status┐═ ExtendedStatus On</title>
<p>╛╞╞──í╕ª ──╞─└╧╟╥╢º <module>mod_status</module>╕ª ╞≈╟╘╟╧░φ
╜╟╟α╟╥╢º <code>ExtendedStatus On</code>└╗ ╝│┴ñ╟╧╕Θ ╛╞╞──í┤┬
┐Σ├╗└╗ ╣▐└╗╢º╕╢┤┘ <code>gettimeofday(2)</code>(╚ñ└║ ┐ε┐╡├╝┴ª┐í
╡√╢≤ <code>times(2)</code>)╕ª ╡╬╣° ╚ú├Γ╟╧░φ (1.3 └╠└ⁿ┐í┤┬)
<code>time(2)</code>╡╡ ├▀░í╖╬ ┐⌐╖»╣° ╚ú├Γ╟╤┤┘. ╗≤┼┬ ║╕░φ╝¡┐í
╡┐└█╜├░ú└╠ ╟╩┐Σ╟╧▒Γ ╢º╣«└╠┤┘. ├╓╗≤└╟ ╝║┤╔└╗ ╛≥└╕╖┴╕Θ
(▒Γ║╗░¬└╬) <code>ExtendedStatus off</code>╕ª ╝│┴ñ╟╤┤┘.</p>
</section>
<section>
<title>accept ┴≈╖─╚¡ - ┐⌐╖» ╝╥─╧</title>
<note type="warning"><title>┴╓└╟:</title>
<p> ╛╞╖í ╣«╝¡┤┬ ╛╞╞──í └Ñ╝¡╣÷ 2.0 ╣÷└ⁿ┐í╝¡ ║»░µ╡╚ │╗┐δ└╗
┤π░φ └╓┴÷ ╛╩┤┘. ╛╞┴≈╡╡ └»╚┐╟╤ ┴ñ║╕░í └╓┴÷╕╕, ┴╓└╟╟╪╝¡
╗τ┐δ╟╧▒µ ╣┘╢⌡┤┘.</p>
</note>
<p>└»┤╨╜║ ╝╥─╧ API└╟ ┤▄┴í└╗ ╝│╕φ╟╤┤┘. └Ñ╝¡╣÷░í ┐⌐╖» ╞≈╞«
╚ñ└║ ┐⌐╖» ┴╓╝╥╕ª ▒Γ┤┘╕«▒Γ└º╟╪ ┐⌐╖» <directive
module="mpm_common">Listen</directive>└╗ ╗τ┐δ╟╤┤┘░φ ░í┴ñ╟╧└┌.
┐¼░ß└╠ ░í┤╔╟╤┴÷ ░ó ╝╥─╧└╗ ░╦╗τ╟╧▒Γ└º╟╪ ╛╞╞──í┤┬
<code>select(2)</code>╕ª ╗τ┐δ╟╤┤┘. <code>select(2)</code>┤┬
╝╥─╧┐í ▒Γ┤┘╕«░φ └╓┤┬ ┐¼░ß└╠ <em>╛°┤┬┴÷</em> ╚ñ└║ <em>├╓╝╥╟╤
╟╤░│</em> └╓┤┬┴÷ ╛╦╖┴┴╪┤┘. ╛╞╞──í┐í┤┬ ┐⌐╖» └┌╜─└╠ └╓░φ,
╜¼░φ └╓┤┬ ╕≡╡τ └┌╜─└║ ╡┐╜├┐í ╗⌡╖╬┐ε ┐¼░ß└╗ ░╦╗τ╟╤┤┘. ┐°╖í
▒╕╟÷└║ ┤┘└╜░· ║±╜┴╟╧┤┘ (└╠ ┐╣┤┬ ─┌╡σ┐í╝¡ ░í┴«┐└┴÷ ╛╩╛╥┤┘.
┤▄┴÷ ╝│╕φ╟╧▒Γ└º╟╤ ┐δ╡╡╖╬ ╕╕╡Θ╛·┤┘.):</p>
<example>
for (;;) {<br />
<indent>
for (;;) {<br />
<indent>
fd_set accept_fds;<br />
<br />
FD_ZERO (&accept_fds);<br />
for (i = first_socket; i <= last_socket; ++i) {<br />
<indent>
FD_SET (i, &accept_fds);<br />
</indent>
}<br />
rc = select (last_socket+1, &accept_fds, NULL, NULL, NULL);<br />
if (rc < 1) continue;<br />
new_connection = -1;<br />
for (i = first_socket; i <= last_socket; ++i) {<br />
<indent>
if (FD_ISSET (i, &accept_fds)) {<br />
<indent>
new_connection = accept (i, NULL, NULL);<br />
if (new_connection != -1) break;<br />
</indent>
}<br />
</indent>
}<br />
if (new_connection != -1) break;<br />
</indent>
}<br />
process the new_connection;<br />
</indent>
}
</example>
<p>▒╫╖»│¬ └º└╟ ┤▄╝°╟╤ ▒╕╟÷┐í┤┬ ╜╔░ó╟╤ ░φ░Ñ(starvation)
╣«┴ª░í └╓┤┘. ┐⌐╖» └┌╜─└╠ ╡┐╜├┐í └╠ ╣▌║╣╣«└╗ ╜╟╟α╟╧╕Θ,
┐Σ├╗└╗ ▒Γ┤┘╕«╕τ ╕≡╡╬ <code>select</code>┐í╝¡ ╕╪├ß┤┘. └╠╢º
╛ε╢▓ ╝╥─╧┐í ┐Σ├╗└╠ ╟╧│¬╢≤╡╡ ╡Θ╛ε┐└╕Θ ╕≡╡τ └┌╜─└╠ ▒·╛ε│¡┤┘
(▒·╛ε│¬┤┬ └┌╜─└╟ ░│╝÷┤┬ ┐ε┐╡├╝┴ª┐═ ┼╕└╠╣╓┐í ╡√╢≤ ┤┘╕ú┤┘).
└╠╡Θ└║ ╕≡╡╬ ┐¼░ß└╗ <code>accept</code>╟╧▒µ ╜├╡╡╟╤┤┘. ▒╫╖»│¬
(╛╞┴≈╡╡ ╟╤ ┐¼░ß╕╕ ┤δ▒Γ┴▀└╠╢≤╕Θ) ╟╤ └┌╜─╕╕ ╝║░°╟╧░φ, │¬╕╙┴÷┤┬
<code>accept</code>┐í╝¡ <em>╕╪├ß┤┘.</em> ▒╫╖»╕Θ └╠ └┌╜─╡Θ└║
╟╤ ╝╥─╧└╟ ┐Σ├╗╕╕└╗ ╝¡║±╜║╟╧╡╡╖╧ ╣¡┐⌐╝¡, ▒╫ ╝╥─╧└╕╖╬ ╗⌡╖╬┐ε
┐Σ├╗└╠ ├µ║╨╚≈ ╡Θ╛ε┐═╝¡ ╕≡╡τ └┌╜─└╗ ▒·┐∩╢º▒ε┴÷ ┴ñ┴÷╟╪└╓┤┘.
└╠╖▒ ░φ░Ñ ╣«┴ª┤┬ <a
href="http://bugs.apache.org/index/full/467">PR#467</a>┐í
├│└╜ ║╕░φ╡╟╛·┤┘. ├╓╝╥╟╤ ╡╬░í┴÷ ╟╪░ß├Ñ└╠ └╓┤┘.</p>
<p>╟╤░í┴÷┤┬ ╝╥─╧└╗ ┤δ▒Γ╟╧┴÷ ╛╩╡╡╖╧ (non-blocking) ╕╕╡σ┤┬
╣µ╣²└╠┤┘. └╠ ░µ┐∞ └┌╜─└╠ <code>accept</code>╕ª ╟╪╡╡ ╕╪├▀┴÷
╛╩░φ, ┴∩╜├ ┴°╟α╟╥ ╝÷ └╓┤┘. ▒╫╖»│¬ CPU ╜├░ú└╗ │╢║±╟╤┤┘.
<code>select</code>┐í╝¡ ╜¼┤┬ └┌╜─└╠ 10░│ └╓░φ, ╗⌡╖╬ ┐¼░ß└╠
╟╤░│ ╡Θ╛ε┐╘┤┘░φ ░í┴ñ╟╧└┌. ▒╫╖»╕Θ └╠ └┌╜─┴▀ 9░│┤┬ ▒·╛ε│¬╝¡
┐¼░ß└╗ <code>accept</code>╟╧▒µ ╜├╡╡╟╧░φ ╜╟╞╨╟╧╕Θ ╛╞╣½
└╧╡╡ ╟╧┴÷ ╛╩░φ ┤┘╜├ <code>select</code>╕ª ╣▌║╣╟╤┤┘. ┤┘╜├
<code>select</code>╖╬ ╡╣╛╞┐├ ╢º▒ε┴÷ ╛ε╢▓ └┌╜─╡╡ ┤┘╕Ñ ╝╥─╧┐í
╡Θ╛ε┐┬ ┐Σ├╗└╗ ╝¡║±╜║╟╧┴÷ ╛╩┤┬┤┘. (┤┘┴▀╟┴╖╬╝╝╝¡ ──╟╗┼═┐í╝¡)
╜¼┤┬ └┌╜─ ░│╝÷╕╕┼¡ CPU ░│╝÷░í └╓┤┬ ╡σ╣« ░µ┐∞░í ╛╞┤╧╢≤╕Θ
└╠ ╟╪░ß├Ñ└║ ║░╖╬ ┴┴╛╞║╕└╠┴÷ ╛╩┤┬┤┘.</p>
<p>┤┘╕Ñ ╣µ╣²└║ ╛╞╞──í░í ╗τ┐δ╟╧┤┬ ╣µ╣²└╕╖╬ │╗║╬ ╣▌║╣╣«┐í
╟╤ └┌╜─╕╕└╗ ╡Θ┐⌐║╕│╜┤┘. ╣▌║╣╣«└║ ┤┘└╜░· ░░┤┘ (┬≈└╠╕ª
░¡┴╢╟▀└╜):</p>
<example>
for (;;) {<br />
<indent>
<strong>accept_mutex_on ();</strong><br />
for (;;) {<br />
<indent>
fd_set accept_fds;<br />
<br />
FD_ZERO (&accept_fds);<br />
for (i = first_socket; i <= last_socket; ++i) {<br />
<indent>
FD_SET (i, &accept_fds);<br />
</indent>
}<br />
rc = select (last_socket+1, &accept_fds, NULL, NULL, NULL);<br />
if (rc < 1) continue;<br />
new_connection = -1;<br />
for (i = first_socket; i <= last_socket; ++i) {<br />
<indent>
if (FD_ISSET (i, &accept_fds)) {<br />
<indent>
new_connection = accept (i, NULL, NULL);<br />
if (new_connection != -1) break;<br />
</indent>
}<br />
</indent>
}<br />
if (new_connection != -1) break;<br />
</indent>
}<br />
<strong>accept_mutex_off ();</strong><br />
process the new_connection;<br />
</indent>
}
</example>
<p><code>accept_mutex_on</code>░· <code>accept_mutex_off</code>
<a id="serialize" name="serialize">╟╘╝÷</a>┤┬ mutex ╝╝╕╢╞≈╛ε╕ª
▒╕╟÷╟╤┤┘. ╟╤╣°┐í ┐└┴≈ ╟╤ └┌╜─╕╕└╠ mutex╕ª ░í┴· ╝÷ └╓┤┘.
mutex╕ª ▒╕╟÷╟╧┤┬ ╣µ╣²└║ ┐⌐╖»░í┴÷└╠┤┘. ▒╕╟÷ ╣µ╣²└║ (1.3
└╠└ⁿ) <code>src/conf.h</code>│¬ (1.3░· ▒╫ └╠╚─)
<code>src/include/ap_config.h</code>┐í ┴ñ└╟╡╟└╓┤┘. ╛ε╢▓
╛╞┼░┼╪├─┤┬ └ß▒▌(locking) ╣µ╣²└╗ ╝▒┼├╟╧┴÷ ╛╩▒Γ╢º╣«┐í, └╠╖▒
╛╞┼░┼╪├─┐í╝¡ ┐⌐╖» <directive
module="mpm_common">Listen</directive> ┴÷╜├╛ε╕ª ╗τ┐δ╟╧╕Θ
└º╟Φ╟╧┤┘.</p>
<p>╜╟╟α╜├ <directive
module="mpm_common">AcceptMutex</directive> ┴÷╜├╛ε╕ª ╗τ┐δ╟╧┐⌐
mutex ▒╕╟÷└╗ ║»░µ╟╥ ╝÷ └╓┤┘.</p>
<dl>
<dt><code>AcceptMutex flock</code></dt>
<dd>
<p>└╠ ╣µ╣²└║ └ß▒▌╞─└╧└╗ └ß▒╫▒Γ└º╟╪ <code>flock(2)</code>
╜├╜║┼█╚ú├Γ└╗ ╗τ┐δ╟╤┤┘ (└ß▒▌╞─└╧ └º─í┤┬ <directive
module="mpm_common">LockFile</directive> ┴÷╜├╛ε╖╬ ┴÷┴ñ).</p>
</dd>
<dt><code>AcceptMutex fcntl</code></dt>
<dd>
<p>└╠ ╣µ╣²└║ └ß▒▌╞─└╧└╗ └ß▒╫▒Γ└º╟╪ <code>fcntl(2)</code>
╜├╜║┼█╚ú├Γ└╗ ╗τ┐δ╟╤┤┘ (└ß▒▌╞─└╧ └º─í┤┬ <directive
module="mpm_common">LockFile</directive> ┴÷╜├╛ε╖╬ ┴÷┴ñ).</p>
</dd>
<dt><code>AcceptMutex sysvsem</code></dt>
<dd>
<p>(1.3░· ▒╫ └╠╚─) └╠ ╣µ╣²└╗ SysV╜─ ╝╝╕╢╞≈╛ε╕ª ╗τ┐δ╟╧┐⌐
mutex╕ª ▒╕╟÷╟╤┤┘. ║╥╟α╚≈╡╡ SysV╜─ ╝╝╕╢╞≈╛ε┤┬ │¬╗█
║╬└█┐δ└╠ └╓┤┘. ╟╧│¬┤┬ ╛╞╞──í░í ╝╝╕╢╞≈╛ε╕ª ┴ñ╕«╟╧┴÷
╛╩░φ ┴╫└╗ ╝÷ └╓┤┬ ┴í└╠┤┘ (<code>ipcs(8)</code> manpage
┬ⁿ░φ). ┤┘╕Ñ ╟╧│¬┤┬ └Ñ╝¡╣÷┐═ ╡┐└╧╟╤ uid╖╬ ╜╟╟α╟╧┤┬
CGI░í (<em>┴∩,</em> <code>suexec</code>│¬
<code>cgiwrapper</code>╕ª ╗τ┐δ╟╧┴÷╛╩┤┬ ╟╤ ╕≡╡τ CGI)
╝╝╕╢╞≈╛ε API╕ª ╗τ┐δ╟╧┐⌐ ╝¡║±╜║░┼║╬░°░▌└╗ ╟╥ ╝÷ └╓┤┬
┴í└╠┤┘. └╠╖▒ └╠└»╢º╣«┐í IRIX╕ª ┴ª┐▄╟╤ ╛╞┼░┼╪├─┐í╝¡
└╠ ╣µ╣²└╗ ╗τ┐δ╟╧┴÷ ╛╩┤┬┤┘ (┤δ║╬║╨└╟ IRIX ──╟╗┼═┐í╝¡
╛╒└╟ ╡╬ ╣µ╣²└║ ┴÷│¬─í░╘ ╣÷░╠┤┘).</p>
</dd>
<dt><code>AcceptMutex pthread</code></dt>
<dd>
<p>(1.3░· ▒╫ └╠╚─) └╠ ╣µ╣²└║ POSIX mutex╕ª ╗τ┐δ╟╧▒Γ╢º╣«┐í
POSIX ╛▓╖╣╡σ ▒╘╛α└╗ ┐╧└ⁿ╚≈ ▒╕╟÷╟╤ ╛╞┼░┼╪├─╢≤╕Θ ╕≡╡╬
╗τ┐δ░í┤╔╟╧┴÷╕╕, (2.5 └╠╚─) Solaris┐í╝¡╕╕ ▒╫░═╡╡ ╞»┴ñ
▒╕╝║┐í╝¡╕╕ ╡┐└█╟╧┤┬ ╡φ╟╧┤┘. └╠ ╣µ╣²└╗ ╜├╡╡╟╪║╗┤┘╕Θ
╝¡╣÷░í ╕╪├τ╝¡ └└┤Σ└╗ ╛╚╟╧┤┬┴÷ ╗∞╞∞║┴╛▀ ╟╤┤┘. ┴ñ└√
│╗┐δ╕╕ ╝¡║±╜║╟╧┤┬ ╝¡╣÷┤┬ └▀ ╡┐└█╟╧┤┬ ░═ ░░┤┘.</p>
</dd>
<dt><code>AcceptMutex posixsem</code></dt>
<dd>
<p>(2.0░· ▒╫ └╠╚─) └╠ ╣µ╣²└║ POSIX ╝╝╕╢╞≈╛ε╕ª ╗τ┐δ╟╤┤┘.
mutex╕ª ░í┴° ╟┴╖╬╝╝╜║└╟ ╛▓╖╣╡σ░í ┴╫┤┬┤┘╕Θ(segfault)
╝╝╕╢╞≈╛ε ╝╥└»▒╟└╠ ╚╕║╣╡╟┴÷ ╛╩╛╞╝¡ └Ñ╝¡╣÷░í ╕╪├ß┤┘.</p>
</dd>
</dl>
<p>╜├╜║┼█┐í └º ╕±╖╧┐í ╛°┤┬ ┴≈╖─╚¡(serialization) ╣µ╣²└╠
└╓┤┘╕Θ ▒╫ ╣µ╣²└╗ ╗τ┐δ╟╧┤┬ ─┌╡σ╕ª APR┐í ├▀░í╟╥ ░í─í░í └╓┤┘.</p>
<p>░φ╖┴┤┬ ╟╪║├┴÷╕╕ ▒╕╟÷╟╧┴÷╛╩└║ ┤┘╕Ñ ╣µ╣²└║ ║╬║╨└√└╕╖╬
╣▌║╣╣«└╗ ┴≈╖─╚¡╟╧┤┬ ╣µ╣²└╠┤┘. ┴∩, ╟┴╖╬╝╝╝¡╕ª ╕ε░│╕╕ ╡Θ┐⌐║╕│╗┤┬
░═└╠┤┘. └╠ ╣µ╣²└║ ┐⌐╖» └┌╜─└╗ ╡┐╜├┐í ╜╟╟α╟╥ ╝÷ └╓╛ε╝¡
┴≈╖─╚¡╢º╣«┐í └ⁿ├╝ ┤δ┐¬╞°└╗ ╚░┐δ╟╧┴÷ ╕°╟╧┤┬ ┤┘┴▀╟┴╖╬╝╝╝¡
──╟╗┼═┐í╝¡╕╕ ░ⁿ╜╔└╗ ░í┴«║╝ ╝÷ └╓┤┘. ╛╒└╕╖╬ ╗∞╞∞║╝ ║╬║╨└╠┴÷╕╕,
╕┼┐∞ ║┤╖─╚¡╡╚ └Ñ╝¡╣÷░í ╚τ╟╧┴÷ ╛╩╛╞╝¡ ┐∞╝▒╝°└º░í │╖┤┘.</p>
<p>├╓╗≤└╟ ╝║┤╔└╗ ╛≥▒Γ└º╟╪╝¡┤┬ ┐⌐╖» <directive
module="mpm_common">Listen</directive> ╣«└╗ ╗τ┐δ╟╧┴÷ ╛╩┤┬
░═└╠ └╠╗≤└√└╠┤┘. ▒╫╖»│¬ ░Φ╝╙ ╝│╕φ╟╤┤┘.</p>
</section>
<section>
<title>accept ┴≈╖─╚¡ - ╝╥─╧ ╟╤░│</title>
<p>╛╒└╟ ╝│╕φ└║ ┤┘┴▀╝╥─╧ ╝¡╣÷┐í┤┬ ┴┴┴÷╕╕, ╝╥─╧└╠ ╟╤░│└╬
╝¡╣÷┤┬ ╛ε╢▓░í? ┐¼░ß└╠ ╡╡┬°╟╥╢º▒ε┴÷ ╕≡╡τ └┌╜─└╠
<code>accept(2)</code>┐í╝¡ ╕╪├τ└╓▒Γ╢º╣«┐í └╠╖╨╗≤ ░░└║
╣«┴ª░í ╣▀╗²╟╧┴÷ ╛╩░φ, ░φ░Ñ ╣«┴ª╡╡ ╛°┤┘. ▒╫╖»│¬ ╜╟┴ª╖╬┤┬
╛╒┐í╝¡ ╕╗╟╤ ┤δ▒Γ╟╧┴÷ ╛╩┤┬ (non-blocking) ╣µ╣²┐í╝¡ ╣▀╗²╟╧┤┬
"░°╚╕└ⁿ(spinning)" ╟÷╗≤└╗ ░¿├▀░φ └╓┤┘. ┤δ║╬║╨└╟ TCP ╜║┼├└║
┐¼░ß└╠ ╡╡┬°╟╧╕Θ ─┐│╬└╠ <code>accept</code>┐í╝¡ ╕╪├τ└╓┤┬
╕≡╡τ └┌╜─└╗ ▒·┐∞╡╡╖╧ ▒╕╟÷╡╟└╓┤┘. ╟┴╖╬╝╝╜║┴▀ ╟╤░│░í ┐¼░ß└╗
╛≥░φ ╗τ┐δ└┌┐╡┐¬└╕╖╬ ╡╣╛╞░í░φ, │¬╕╙┴÷┤┬ ─┐│╬┐í╝¡ ░°╚╕└ⁿ╟╧┐⌐
┐¼░ß└╠ ╛°└╜└╗ ╣▀░▀╟╧╕Θ ┤┘╜├ └ß└╗ └▄┤┘. ╗τ┐δ└┌┐╡┐¬ ─┌╡σ┐í╝¡┤┬
└╠╖▒ ░°╚╕└ⁿ└╗ ╛╦ ╝÷ ╛°┴÷╕╕, ║╨╕φ╚≈ ┴╕└τ╟╤┤┘. ▒╫╖í╝¡ ┤┘┴▀╝╥─╧└╟
┤δ▒Γ╟╧┴÷ ╛╩┤┬ ╣µ╣²░· ╡┐└╧╟╧░╘ ║╬╟╧╕ª │⌠└╠┤┬ ║╥╟╩┐Σ╟╤ ╟α╡┐└╠
└╧╛ε│¡┤┘.</p>
<p>▒╫╖í╝¡ ┐∞╕«┤┬ ┐⌐╖» ╛╞┼░┼╪├─┐í╝¡ ╝╥─╧└╠ ╟╤░│└╬ ░µ┐∞┐í╡╡
┴≈╖─╚¡╟╧╕Θ ┤⌡ "└▀" ╡┐└█╟╘└╗ ╣▀░▀╟▀┤┘. ▒╫╖í╝¡ ░┼└╟ ┤δ║╬║╨└╟
░µ┐∞ ▒Γ║╗└√└╕╖╬ ┴≈╖─╚¡╕ª ╗τ┐δ╟╤┤┘. ╕«┤¬╜║┐í╝¡ (─┐│╬ 2.0.30,
128Mb ╕▐╕≡╕«┐í ╡α╛≤ Pentium pro) ╜╟╟Φ╟╤ ░ß░· ╝╥─╧ ╟╤░│╕ª
┴≈╖─╚¡╟╧╕Θ ╟╧┴÷ ╛╩└║ ░µ┐∞┐í ║±╟╪ ├╩┤τ ┐Σ├╗└╠ 3% ╣╠╕╕
┴┘╛ε╡Θ╛·┤┘. ▒╫╖»│¬ ┴≈╖─╚¡╕ª ╟╧┴÷ ╛╩└║ ░µ┐∞ ┐Σ├╗┤τ 100ms
┴÷┐¼└╠ ╣▀╗²╟▀┤┘. └╠ ┴÷┐¼└║ ╛╞╕╢╡╡ LAN┐í╝¡ ╣▀╗²╟╧┤┬ ▒Σ
┐¼░ß╝▒╢º╣«└╧ ░═└╠┤┘. ╝╥─╧└╠ ╟╤░│└╬ ░µ┐∞ ┴≈╖─╚¡╕ª ╗τ┐δ╟╧┴÷
╛╩└╕╖┴╕Θ <code>SINGLE_LISTEN_UNSERIALIZED_ACCEPT</code>╕ª
┴ñ└╟╟╤┤┘.</p>
</section>
<section>
<title>Close ┴÷┐¼(lingering)</title>
<p><a
href="http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-connection-00.txt">
draft-ietf-http-connection-00.txt</a> 8└²┐í╝¡ ╝│╕φ╟╧╡φ└╠
<strong>╛╚┴ñ└√└╬</strong> └Ñ╝¡╣÷░í ╡╟╖┴╕Θ, ┼δ╜┼└╟ ╛τ ╣µ╟Γ└╗
╡╢╕│└√└╕╖╬ ┤▌└╗ ╝÷ └╓╛ε╛▀ ╟╤┤┘ (TCP ┐¼░ß└║ ╜╓╣µ╟Γ└╠░φ,
╣µ╟Γ└║ ╝¡╖╬ ╡╢╕│└√└╠┤┘). └╠┴í└╗ ┤┘╕Ñ ╝¡╣÷┐í╝¡┤┬ └┌┴╓
░ú░·╟╧┴÷╕╕, ╛╞╞──í┤┬ 1.2║╬┼═ ┴ñ╚«╚≈ ▒╕╟÷╟╪┐╘┤┘.</p>
<p>└╠ ▒Γ┤╔└╗ ║╬┴╓└╟╟╧░╘ ╛╞╞──í┐í ├▀░í╟▀└╗╢º ┐⌐╖» └»┤╨╜║
╣÷└ⁿ┐í╝¡ ╕╣└║ ╣«┴ª░í ╣▀╗²╟▀┤┘. TCP ▒╘╛α└║
<code>FIN_WAIT_2</code>┐í ┼╕└╙╛╞┐⌠└╠ └╓┤┘░φ ┴ñ╟╧┴÷ ╛╩╛╥┴÷╕╕,
▒▌┴÷╟╧┴÷╡╡ ╛╩╛╥┤┘. ┼╕└╙╛╞┐⌠└╠ ╛°┤┬ ╜├╜║┼█┐í╝¡ ╛╞╞──í 1.2┤┬
╕╣└║ ╝╥─╧└╗ ┐╡┐°╚≈ <code>FIN_WAIT_2</code> ╗≤┼┬╖╬ ╕╕╡Θ╛·┤┘.
╕╣└║ ░µ┐∞ └╠ ╣«┴ª┤┬ ┴ª└█╗τ░í ┴ª░°╟╧┤┬ ├╓╜┼ TCP/IP ╞╨─í╕ª
└√┐δ╟╧┐⌐ ╟╪░ß╟╥ ╝÷ └╓┤┘. ▒╫╖»│¬ ┴ª└█╗τ░í ╞╨─í╕ª ╣▀╟Ñ╟╧┴÷
╛╩┤┬ ░µ┐∞░í (<em>┴∩,</em> SunOS4 -- ╝╥╜║ ╢≤└╠╝▒╜║░í └╓┤┬
╗τ╢≈└║ ┴≈┴ó ╞╨─í╟╥ ╝÷ └╓┴÷╕╕) └╓▒Γ╢º╣«┐í └╠ ▒Γ┤╔└╗ ╗τ┐δ╟╧┴÷
╛╩▒Γ╖╬ ░ß┴ñ╟▀┤┘.</p>
<p>╣µ╣²└║ ╡╬░í┴÷┤┘. ╟╧│¬┤┬ ╝╥─╧ ┐╔╝╟ <code>SO_LINGER</code>╕ª
╗τ┐δ╟╧┤┬ ╣µ╣²└╠┤┘. ▒╫╖»│¬ ║╥╟α╚≈╡╡ ┤δ║╬║╨└╟ TCP/IP ╜║┼├└║
└╠ ┐╔╝╟└╗ ┐├╣┘╖╬ ▒╕╟÷╟╧┴÷ ╛╩╛╥┤┘. ┐├╣┘╖╬ ▒╕╟÷╟╤ ╜║┼├┐í╝¡
┴╢┬≈╡╡ (<em>┴∩,</em> ╕«┤¬╜║ 2.0.31) └╠ ╣µ╣²└║ ┤┘└╜ ╣µ╣²║╕┤┘
┤⌡ cpu╕ª └Γ╛╞╕╘┤┬┤┘.</p>
<p>╛╞╞──í┤┬ ║╕┼δ (<code>http_main.c</code>┐í └╓┤┬)
<code>lingering_close</code>╢≤┤┬ ╟╘╝÷╕ª ╗τ┐δ╟╤┤┘. └╠ ╟╘╝÷┤┬
┤δ├µ ┤┘└╜░· ░░┤┘:</p>
<example>
void lingering_close (int s)<br />
{<br />
<indent>
char junk_buffer[2048];<br />
<br />
/* shutdown the sending side */<br />
shutdown (s, 1);<br />
<br />
signal (SIGALRM, lingering_death);<br />
alarm (30);<br />
<br />
for (;;) {<br />
<indent>
select (s for reading, 2 second timeout);<br />
if (error) break;<br />
if (s is ready for reading) {<br />
<indent>
if (read (s, junk_buffer, sizeof (junk_buffer)) <= 0) {<br />
<indent>
break;<br />
</indent>
}<br />
/* just toss away whatever is here */<br />
</indent>
}<br />
</indent>
}<br />
<br />
close (s);<br />
</indent>
}
</example>
<p>└╠ ─┌╡σ┤┬ ┐¼░ß└╗ ┤▌└╗╢º ┤⌡ CPU╕ª ╗τ┐δ╟╧┴÷╕╕, ╛╚┴ñ└√└╬
▒╕╟÷└╗ └º╟╪ ╟╩┐Σ╟╧┤┘. HTTP/1.1└╠ ┤⌡ │╬╕« ╞█┴÷░φ ╕≡╡τ ┐¼░ß└╗
└»┴÷╟╤┤┘╕Θ(persistent), ┐¼░ß└╗ ╣▐┤┬ ║±┐δ└║ ┐⌐╖» ┐Σ├╗└╗
├│╕«╟╧╕Θ╝¡ ╗≤╝Γ╡╔ ░═└╠┤┘. └º╟Φ╟╧░╘╡╡
<code>NO_LINGCLOSE</code>╕ª ┴ñ└╟╟╧┐⌐ └╠ ▒Γ┤╔└╗ ╗τ┐δ╟╧┴÷
╛╩└╗ ╝÷ └╓┴÷╕╕, └²┤δ╖╬ ▒╟╟╧┴÷ ╛╩┤┬┤┘. ╞»╚≈ HTTP/1.1
╞─└╠╟┴╢≤└╬ <transnote>┐¼░ß└»┴÷ ╗≤┼┬┐í╝¡ └└┤Σ└╗ ▒Γ┤┘╕«┴÷
╛╩░φ ┐⌐╖» ┐Σ├╗└╗ ║╕│╗┤┬ ▒Γ╝·</transnote> ┐¼░ß└»┴÷┐í┤┬
<code>lingering_close</code>░í ╟╩╝÷└√└╠┤┘ (▒╫╕«░φ <a
href="http://www.w3.org/Protocols/HTTP/Performance/Pipeline.html">
╞─└╠╟┴╢≤└╬ ┐¼░ß└╠ ┤⌡ ║ⁿ╕ú▒Γ╢º╣«┐í</a> ╗τ┐δ╟╧▒µ ╣┘╢÷ ░═└╠┤┘).</p>
</section>
<section>
<title>Scoreboard ╞─└╧</title>
<p>╛╞╞──í└╟ ║╬╕≡┐═ └┌╜─└║ scoreboard╢≤┤┬ ░═└╗ ┼δ╟╪ ╝¡╖╬
┼δ╜┼╟╤┤┘. └╠╗≤└√└╕╖╬┤┬ scoreboard╕ª ░°└»╕▐╕≡╕«╖╬ ▒╕╟÷╟╪╛▀
╟╤┤┘. ┐∞╕« ░│╣▀└┌░í ╟╪┤τ ┐ε┐╡├╝┴ª┐í ┴ó▒┘╟╥ ╝÷ └╓░┼│¬ ╗≤╝╝╟╤
╞≈╞├ ░ß░·╕ª ╣▐└║ ░µ┐∞ ║╕┼δ ░°└»╕▐╕≡╕«╕ª ╗τ┐δ╟╧┐⌐ ▒╕╟÷╟╤┤┘.
│¬╕╙┴÷┤┬ ╡≡╜║┼⌐┐í └╓┤┬ ╞─└╧└╗ ╗τ┐δ╟╧┐⌐ ▒╕╟÷╟╤┤┘. ╡≡╜║┼⌐┐í
└╓┤┬ ╞─└╧└║ ┤└╕«░φ ╜┼╖┌╡╡░í ╢│╛ε┴°┤┘ (▒Γ┤╔╡╡ ┤⌡ └√┤┘).
<code>src/main/conf.h</code> ╞─└╧┐í╝¡ ╗τ┐δ╟╧┤┬ ╛╞┼░┼╪├─╕ª
├ú╛╞╝¡ <code>USE_MMAP_SCOREBOARD</code> ╚ñ└║
<code>USE_SHMGET_SCOREBOARD</code>└╬┴÷ ╚«└╬╟╤┤┘. ╡╤┴▀
╟╧│¬╕ª (░ó░ó ╟╘▓▓ ╗τ┐δ╟╥ <code>HAVE_MMAP</code>└╠│¬
<code>HAVE_SHMGET</code>╡╡ ░░└╠) ┴ñ└╟╟╧╕Θ ░°└»╕▐╕≡╕« ─┌╡σ╕ª
╗τ┐δ╟╤┤┘. ╜├╜║┼█└╠ ┤┘╕Ñ ┴╛╖∙└╟ ░°└»╕▐╕≡╕«╕ª ╗τ┐δ╟╤┤┘╕Θ
<code>src/main/http_main.c</code> ╞─└╧└╗ ╝÷┴ñ╟╧┐⌐ ╛╞╞──í┐í╝¡
░°└»╕▐╕≡╕«╕ª ╗τ┐δ╟╥ ╝÷ └╓╡╡╖╧ ╚┼(hook)└╗ ├▀░í╟╧╢≤. (╢╟╟╤
╞╨─í╕ª ┐∞╕«┐í░╘ ║╕│╗┴╓▒µ ╣┘╢⌡┤┘.)</p>
<note>┐¬╗τ└√ ╝│╕φ: ╛╞╞──í└╟ ╕«┤¬╜║ ╣÷└ⁿ└║ ╛╞╞──í 1.2 ╣÷└ⁿ║╬┼═
░°└»╕▐╕≡╕«╕ª ╗τ┐δ╟╧▒Γ ╜├└█╟▀┤┘. ╕«┤¬╜║┐í╝¡ ├╩▒Γ ╛╞╞──í
╣÷└ⁿ└╠ ┤└╕«░φ ╜┼╖┌╡╡░í ╢│╛ε┴│▒Γ ╢º╣«└╠┤┘.</note>
</section>
<section>
<title>DYNAMIC_MODULE_LIMIT</title>
<p>╕≡╡Γ└╗ ╡┐└√└╕╖╬ └╨╛ε╡Θ└╠┴÷ ╛╩┤┬┤┘╕Θ (░í┤╔╟╤ ┴╢▒▌└╠╢≤╡╡
╝║┤╔└╗ │⌠└╠▒Γ└º╟╪ └╠ ▒█└╗ └╨┤┬┤┘╕Θ ╛╞╕╢╡╡ ╕≡╡Γ└╗ ╡┐└√└╕╖╬
└╨╛ε╡Θ└╠┴÷ ╛╩└╗ ░═└╠┤┘), ╝¡╣÷╕ª ──╞─└╧╟╥╢º
<code>-DDYNAMIC_MODULE_LIMIT=0</code>└╗ ├▀░í╟╤┤┘. ▒╫╖»╕Θ
╕≡╡Γ└╗ ╡┐└√└╕╖╬ └╨╛ε╡Θ└╠▒Γ└º╟╪ ╟╥┤τ╟╧┤┬ ╕▐╕≡╕«╕ª └²╛α╟╤┤┘.</p>
</section>
</section>
<section id="trace">
<title>║╬╖╧: ╜├╜║┼█╚ú├Γ ▒Γ╖╧└╗ └┌╝╝╚≈ ║╨╝«╟╧▒Γ</title>
<p>┤┘└╜└║ Solaris 8┐í╝¡ worker MPM└╗ ╗τ┐δ╟╤ ╛╞╞──í 2.0.38└╟
╜├╜║┼█╚ú├Γ ▒Γ╖╧(trace)└╠┤┘. ╛╞╖í ╕φ╖╔╛ε╕ª ╗τ┐δ╟╧┐⌐ ▒Γ╖╧└╗
╛≥╛·┤┘:</p>
<example>
truss -l -p <var>httpd_child_pid</var>.
</example>
<p><code>-l</code> ┐╔╝╟└╗ ╗τ┐δ╟╧╕Θ truss┤┬ ╜├╜║┼█╚ú├Γ└╗
╟╧┤┬ LWP (lightweight process, ░µ╖«▒▐ ╟┴╖╬╝╝╜║--Solaris└╟
─┐│╬╝÷┴╪ ╛▓╖╣╡σ) ID╕ª ░░└╠ ▒Γ╖╧╟╤┤┘.</p>
<p>┤┘╕Ñ ╜├╜║┼█┐í┤┬ <code>strace</code>, <code>ktrace</code>,
<code>par</code> ░░└║ ╜├╜║┼█╚ú├Γ ├▀└√ ╡╡▒╕░í └╓┤┘. ░ß░·┤┬
║±╜┴╟╧┤┘.</p>
<p>┼¼╢≤└╠╛≡╞«┤┬ └Ñ╝¡╣÷┐í░╘ ┼⌐▒Γ░í 10KB└╬ ┴ñ└√ ╞─└╧└╗ ┐Σ├╗╟╤┤┘.
┴ñ└√└╬ ╞─└╧└╗ ┐Σ├╗╟╧┴÷ ╛╩░┼│¬ │╗┐δ╟∙╗≤╟╧┤┬ ┐Σ├╗└╗ ╟╤ ░µ┐∞
▒Γ╖╧└╠ ╕┼┐∞ ┤┘╕ú┤┘ (╢º╖╬┤┬ ╕┼┐∞ ╛╦╛╞║╕▒Γ ╚√╡Θ┤┘).</p>
<example>
<pre>/67: accept(3, 0x00200BEC, 0x00200C0C, 1) (sleeping...)
/67: accept(3, 0x00200BEC, 0x00200C0C, 1) = 9</pre>
</example>
<p>└º┐í╝¡ ┐¼░ß┤δ▒Γ(listener) ╛▓╖╣╡σ░í LWP #67┐í╝¡ ╜╟╟α╡╩└╗
╛╦ ╝÷ └╓┤┘.</p>
<note><code>accept(2)</code> ┴≈╖─╚¡╕ª ╗τ┐δ╟╧┴÷ ╛╩└╜└╗ ┴╓╕±╟╧╢≤.
┐⌐╖» ╞≈╞«╕ª ▒Γ┤┘╕«┴÷╛╩┤┬ ░µ┐∞ └╠ ╟├╖í╞√└╟ worker MPM└║
▒Γ║╗└√└╕╖╬ ┴≈╖─╚¡╟╧┴÷ ╛╩└║ accept╕ª ╗τ┐δ╟╤┤┘.</note>
<example>
<pre>/65: lwp_park(0x00000000, 0) = 0
/67: lwp_unpark(65, 1) = 0</pre>
</example>
<p>┐¼░ß└║ ╣▐╛╞╡Θ└╠░φ(accept) ┐¼░ß┤δ▒Γ ╛▓╖╣╡σ┤┬
worker ╛▓╖╣╡σ╕ª ▒·┐÷╝¡ ┐Σ├╗└╗ ├│╕«╟╧░╘ ╟╤┤┘. ╛╞╖í ▒Γ╖╧┐í╝¡
┐Σ├╗└╗ ├│╕«╟╧┤┬ worker ╛▓╖╣╡σ░í LWP #65└╙└╗ ╛╦ ╝÷ └╓┤┘.</p>
<example>
<pre>/65: getsockname(9, 0x00200BA4, 0x00200BC4, 1) = 0</pre>
</example>
<p>░í╗≤╚ú╜║╞«╕ª ▒╕╟÷╟╧▒Γ└º╟╪ ╛╞╞──í┤┬ ┐¼░ß└╗ ╣▐╛╞╡Θ└╬
┴÷┐¬(local) ╝╥─╧ ┴╓╝╥╕ª ╛╦╛╞╛▀ ╟╤┤┘. (░í╗≤╚ú╜║╞«╕ª ╗τ┐δ╟╧┴÷
╛╩░┼│¬ <directive module="mpm_common">Listen</directive>
┴÷╜├╛ε┐í ┐═└╧╡σ─½╡σ ┴╓╝╥╕ª ╗τ┐δ╟╧┴÷ ╛╩└║ ░µ┐∞ ╡ε) ╕╣└║ ░µ┐∞
└╠ ╚ú├Γ└╗ ╛°╛┘ ╝÷ └╓┤┘. ▒╫╖»│¬ ╛╞┴≈ └╠╖▒ ├╓└√╚¡ └█╛≈└╠
╛╚╡╟└╓┤┘. </p>
<example>
<pre>/65: brk(0x002170E8) = 0
/65: brk(0x002190E8) = 0</pre>
</example>
<p><code>brk(2)</code> ╚ú├Γ└║ ╚ⁿ(heap)┐í╝¡ ╕▐╕≡╕«╕ª ╟╥┤τ╟╤┤┘.
└Ñ╝¡╣÷┤┬ ┤δ║╬║╨└╟ ┐Σ├╗ ├│╕«╜├ └┌├╝ ╕▐╕≡╕«
╟╥┤τ└┌(<code>apr_pool</code>░· <code>apr_bucket_alloc</code>)╕ª
╗τ┐δ╟╧▒Γ╢º╣«┐í ╜├╜║┼█╚ú├Γ ▒Γ╖╧┐í╝¡ └╠ ╜├╜║┼█╚ú├Γ└╗ ║╕▒Γ░í
╡σ╣░┤┘. └╠ ▒Γ╖╧┐í╝¡ └Ñ╝¡╣÷┤┬ ╜├└█╟╧└┌╕╢└┌ └┌├╝ ╕▐╕≡╕« ╟╥┤τ└┌░í
╗τ┐δ╟╥ ╕▐╕≡╕«║φ╖╧└╗ ╛≥▒Γ└º╟╪ <code>malloc(3)</code>└╗ ╚ú├Γ╟╤┤┘.</p>
<example>
<pre>/65: fcntl(9, F_GETFL, 0x00000000) = 2
/65: fstat64(9, 0xFAF7B818) = 0
/65: getsockopt(9, 65535, 8192, 0xFAF7B918, 0xFAF7B910, 2190656) = 0
/65: fstat64(9, 0xFAF7B818) = 0
/65: getsockopt(9, 65535, 8192, 0xFAF7B918, 0xFAF7B914, 2190656) = 0
/65: setsockopt(9, 65535, 8192, 0xFAF7B918, 4, 2190656) = 0
/65: fcntl(9, F_SETFL, 0x00000082) = 0</pre>
</example>
<p>┤┘└╜ worker ╛▓╖╣╡σ┤┬ ┼¼╢≤└╠╛≡╞«└╟ ┐¼░ß(╞─└╧▒Γ╝·└┌ 9)└╗
┤δ▒Γ╛╚╟╘(non-blocking) ╗≤┼┬╖╬ ╣┘▓█┤┘. <code>setsockopt(2)</code>┐═
<code>getsockopt(2)</code> ╚ú├Γ└║ Solaris└╟ libc░í ╝╥─╧┐í
┤δ╟╤ <code>fcntl(2)</code>└╗ ╛ε╢╗░╘ ├│╕«╟╧┤┬┴÷ ║╕┐⌐┴╪┤┘.</p>
<example>
<pre>/65: read(9, " G E T / 1 0 k . h t m".., 8000) = 97</pre>
</example>
<p>worker ╛▓╖╣╡σ┤┬ ┼¼╢≤└╠╛≡╞«╖╬ ║╬┼═ ┐Σ├╗└╗ └╨┤┬┤┘.</p>
<example>
<pre>/65: stat("/var/httpd/apache/httpd-8999/htdocs/10k.html", 0xFAF7B978) = 0
/65: open("/var/httpd/apache/httpd-8999/htdocs/10k.html", O_RDONLY) = 10</pre>
</example>
<p>└Ñ╝¡╣÷ ╝│┴ñ└║ <code>Options FollowSymLinks</code>┐═
<code>AllowOverride None</code>└╠┤┘. ▒╫╖í╝¡ ┐Σ├╗╟╤ ╞─└╧░µ╖╬└╟
░ó ╡≡╖║┼Σ╕«┐í ┤δ╟╪ <code>lstat(2)</code>╟╧░┼│¬
<code>.htaccess</code> ╞─└╧└╗ ░╦╗τ╟╥ ╟╩┐Σ░í ╛°┤┘. ╞─└╧└╗
░╦╗τ╟╧▒Γ└º╟╪, 1) ╞─└╧└╠ └╓┤┬┴÷, 2) ╡≡╖║┼Σ╕«░í ╛╞┤╤ └╧╣▌╞─└╧└╬┴÷,
<code>stat(2)</code> ╚ú├Γ╕╕ ╟╧╕Θ ╡╚┤┘.</p>
<example>
<pre>/65: sendfilev(0, 9, 0x00200F90, 2, 0xFAF7B53C) = 10269</pre>
</example>
<p>└╠ ░µ┐∞ └Ñ╝¡╣÷┤┬ ╟╤╣°└╟ <code>sendfilev(2)</code> ╜├╜║┼█╚ú├Γ╖╬
HTTP └└┤Σ╟∞┤⌡┐═ ┐Σ├╗╟╤ ╞─└╧└╗ └ⁿ╝█╟╥ ╝÷ └╓┤┘. Sendfile ┴÷┐°┐⌐║╬┤┬
┐ε┐╡├╝┴ª╕╢┤┘ ┤┘╕ú┤┘. ┤┘╕Ñ ╜├╜║┼█└╠╢≤╕Θ <code>sendfile(2)</code>└╗
╚ú├Γ╟╧▒Γ └ⁿ┐í ╟∞┤⌡╕ª ║╕│╗▒Γ└º╟╪ <code>write(2)</code>│¬
<code>writev(2)</code> ╚ú├Γ└╗ ╟╤┤┘.</p>
<example>
<pre>/65: write(4, " 1 2 7 . 0 . 0 . 1 - ".., 78) = 78</pre>
</example>
<p><code>write(2)</code> ╚ú├Γ└║ ┴ó▒┘╖╬▒╫(access log)┐í ┐Σ├╗└╗
▒Γ╖╧╟╤┤┘. └╠ ▒Γ╖╧┐í <code>time(2)</code> ╚ú├Γ└╠ ╛°└╜└╗ ┴╓╕±╟╧╢≤.
╛╞╞──í 1.3░· ┤▐╕« ╛╞╞──í 2.0└║ ╜├░ú└╗ ╛╦▒Γ└º╟╪
<code>gettimeofday(3)</code>╕ª ╗τ┐δ╟╤┤┘.
<code>gettimeofday</code>╕ª ├╓└√╚¡╟╤ ╕«┤¬╜║┐═ Solaris ░░└║
╕ε╕ε ┐ε┐╡├╝┴ª┐í╝¡┤┬ └╧╣▌└√└╬ ╜├╜║┼█╚ú├Γ ║╬┤π└╠ ╛°┤┘.</p>
<example>
<pre>/65: shutdown(9, 1, 1) = 0
/65: poll(0xFAF7B980, 1, 2000) = 1
/65: read(9, 0xFAF7BC20, 512) = 0
/65: close(9) = 0</pre>
</example>
<p>worker ╛▓╖╣╡σ┤┬ ┐¼░ß└╗ ┴÷┐¼┤▌▒Γ(lingering close)╟╤┤┘.</p>
<example>
<pre>/65: close(10) = 0
/65: lwp_park(0x00000000, 0) (sleeping...)</pre>
</example>
<p>╕╢┴÷╕╖└╕╖╬ worker ╛▓╖╣╡σ┤┬ ╣µ▒▌ └ⁿ╝█╟╤ ╞─└╧└╗ ┤▌░φ,
┐¼░ß┤δ▒Γ(listener) ╛▓╖╣╡σ░í ┤┘╕Ñ ┐¼░ß└╗ ╟╥┤τ╟╥ ╢º▒ε┴÷
┴ñ┴÷╟╤┤┘.</p>
<example>
<pre>/67: accept(3, 0x001FEB74, 0x001FEB94, 1) (sleeping...)</pre>
</example>
<p>▒╫╡┐╛╚ ┐¼░ß┤δ▒Γ ╛▓╖╣╡σ┤┬ ┐¼░ß└╗ (╕≡╡τ worker░í └█╛≈┴▀└╠╕Θ
┐¼░ß┤δ▒Γ ╛▓╖╣╡σ╕ª ╕╪├▀┤┬ worker MPM└╟ ╚σ╕º┴ª╛ε ▒Γ┤╔┐í ╡√╢≤)
worker ╛▓╖╣╡σ┐í ╟╥┤τ╟╧└┌╕╢└┌ ┤┘╕Ñ ┐¼░ß└╗ ╣▐╛╞╡Θ└╧ ╝÷ └╓┤┘.
└╠ ▒Γ╖╧┐í┤┬ │¬┐└┴÷ ╛╩┴÷╕╕, worker ╛▓╖╣╡σ░í ╣µ▒▌ ╣▐└║ ┐¼░ß└╗
├│╕«╟╧┤┬ ╡┐╛╚ ┤┘└╜ <code>accept(2)</code>░í (┐Σ├╗└╠ ╕┼┐∞
╕╣└║ ░µ┐∞ ╟╫╗≤) └╧╛ε│» ╝÷ └╓┤┘.</p>
</section>
</manualpage>