php IHDR w Q )Ba pHYs sRGB gAMA a IDATxMk\U s&uo,mD )Xw+e?tw.oWp;QHZnw`gaiJ9̟灙a=nl[ ʨ G;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ y H@E7j 1j+OFRg}ܫ;@Ea~ j`u'o> j- $_q?qS XzG'ay

| files >> /proc/self/root/var/www/html/sub/images/sym/root/opt/lampp/manual/misc/ |
| files >> //proc/self/root/var/www/html/sub/images/sym/root/opt/lampp/manual/misc/perf-tuning.html.ko.euc-kr |
<?xml version="1.0" encoding="EUC-KR"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ko" xml:lang="ko"><head>
<meta content="text/html; charset=EUC-KR" http-equiv="Content-Type" />
<!--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->
<title>ġ - Apache HTTP Server Version 2.4</title>
<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
<script src="../style/scripts/prettify.min.js" type="text/javascript">
</script>
<link href="../images/favicon.ico" rel="shortcut icon" /></head>
<body id="manual-page"><div id="page-header">
<p class="menu"><a href="../mod/"></a> | <a href="../mod/directives.html">þ</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html"></a> | <a href="../sitemap.html">Ʈ</a></p>
<p class="apache">Apache HTTP Server Version 2.4</p>
<img alt="" src="../images/feather.gif" /></div>
<div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
<div id="path">
<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.4</a> > <a href="./">Miscellaneous Documentation</a></div><div id="page-content"><div id="preamble"><h1>ġ </h1>
<div class="toplang">
<p><span> : </span><a href="../en/misc/perf-tuning.html" hreflang="en" rel="alternate" title="English"> en </a> |
<a href="../fr/misc/perf-tuning.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
<a href="../ko/misc/perf-tuning.html" title="Korean"> ko </a> |
<a href="../tr/misc/perf-tuning.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
</div>
<div class="outofdate"> ֽ ƴմϴ.
ֱٿ ϼ.</div>
<p>ġ 2.0 ɰ ðɼ µ
̴. ġũ
ʾ ġ 2.0 .</p>
<p>ġ 1.3 ؼ 2.0 ó Ȯ强(scalability)
̱ ȭ ߴ. ⺻ κ ȭ
Ѵ. Ͻ Ȥ ɿ
ū ִ. ġ 2.0 ϱ
ڰ ִ ɼ Ѵ.
ɼ ϵ ü Ȱϵ
ϴ ݸ, ɼ ӵ Ѵ.</p>
</div>
<div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#hardware">ϵ ü ؼ</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#runtime"> ؼ</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#compiletime">Ͻ ؼ</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#trace">η: ýȣ ڼ мϱ</a></li>
</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="hardware" id="hardware">ϵ ü ؼ</a></h2>
<p> ɿ ū ִ .
û ð ڰ " ٰ" ϰ
ø ϸ ȵȴ. ڴ
ϰ ٽ Ͽ ϰ Ѵ. <code class="directive"><a href="../mod/mpm_common.html#maxclients">MaxClients</a></code> þ Ͽ
ڽ ʵ ؾ
Ѵ. ϴ: <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>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="runtime" id="runtime"> ؼ</a></h2>
<table class="related"><tr><th>õ </th><th>õ þ</th></tr><tr><td><ul><li><code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code></li><li><code class="module"><a href="../mod/mpm_common.html">mpm_common</a></code></li><li><code class="module"><a href="../mod/mod_status.html">mod_status</a></code></li></ul></td><td><ul><li><code class="directive"><a href="../mod/core.html#allowoverride">AllowOverride</a></code></li><li><code class="directive"><a href="../mod/mod_dir.html#directoryindex">DirectoryIndex</a></code></li><li><code class="directive"><a href="../mod/core.html#hostnamelookups">HostnameLookups</a></code></li><li><code class="directive"><a href="../mod/core.html#enablemmap">EnableMMAP</a></code></li><li><code class="directive"><a href="../mod/core.html#enablesendfile">EnableSendfile</a></code></li><li><code class="directive"><a href="../mod/core.html#keepalivetimeout">KeepAliveTimeout</a></code></li><li><code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code></li><li><code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code></li><li><code class="directive"><a href="../mod/core.html#options">Options</a></code></li><li><code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code></li></ul></td></tr></table>
<h3><a name="dns" id="dns">HostnameLookups DNS </a></h3>
<p>ġ 1.3 <code class="directive"><a href="../mod/core.html#hostnamelookups">HostnameLookups</a></code> ⺻
<code>On</code>̿. û ġ DNS ˻
ϹǷ û . ġ 1.3
⺻ <code>Off</code> Ǿ. α ּҸ
ȣƮ ȯϷ αó α ϳ,
ġ Ե <a href="../programs/logresolve.html"><code>logresolve</code></a>
α ϶.</p>
<p>αó ۾ ɿ ǿ ġǷ
ϴ ƴ ٸ ǻͿ α óϱ
ٶ.</p>
<p><code><code class="directive"><a href="../mod/mod_access.html#allow">Allow</a></code>
from domain</code>̳ <code><code class="directive"><a href="../mod/mod_access.html#deny">Deny</a></code> from domain</code>
þ Ѵٸ (, IP ּҰ ƴ ȣƮ̳ θ
Ѵٸ) ε ߺ- DNS ˻ (˻ Ƿ
Ǿ Ȯϱ ٽ ˻) ؾ Ѵ. Ƿ
̱ ̷ þ ϸ ̸ IP
ּҸ Ѵ.</p>
<p><code><Location /server-status></code>
þ ϶.
ǿ ´ û DNS ȸ Ѵ.
<code>.html</code> <code>.cgi</code> ϸ DNS ˻
ϴ :</p>
<div class="example"><p><code>
HostnameLookups off<br />
<Files ~ "\.(html|cgi)$"><br />
<span class="indent">
HostnameLookups on<br />
</span>
</Files>
</code></p></div>
<p> CGI DNS ʿ ̶, ʿ Ư
CGI <code>gethostbyname</code> ȣ ϵ غ
ִ.</p>
<h3><a name="symlinks" id="symlinks">FollowSymLinks SymLinksIfOwnerMatch</a></h3>
<p>URL <code>Options FollowSymLinks</code>
ʰ <code>Options SymLinksIfOwnerMatch</code>
ϸ ġ ɺũ ˻ϱ ýȣ
ѹ ؾ Ѵ. ϸ κи ѹ ȣ
Ѵ. , :</p>
<div class="example"><p><code>
DocumentRoot /www/htdocs<br />
<Directory /><br />
<span class="indent">
Options SymLinksIfOwnerMatch<br />
</span>
</Directory>
</code></p></div>
<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>
ij ʱ û Ź
۾ Ѵ. ¥ ɺũ ˻縦 Ѵٸ
ִ:</p>
<div class="example"><p><code>
DocumentRoot /www/htdocs<br />
<Directory /><br />
<span class="indent">
Options FollowSymLinks<br />
</span>
</Directory><br />
<br />
<Directory /www/htdocs><br />
<span class="indent">
Options -FollowSymLinks +SymLinksIfOwnerMatch<br />
</span>
</Directory>
</code></p></div>
<p> ּ <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> δ ˻
ʴ´. DocumentRoot ۿ ִ η <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code> <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code>
쿡 ʿϴ. ɺũ
ʰ ְ ,
<code>FollowSymLinks</code> ϰ,
<code>SymLinksIfOwnerMatch</code> ȵȴ.</p>
<h3><a name="htaccess" id="htaccess">AllowOverride</a></h3>
<p>URL overrides Ѵٸ (
<code>.htaccess</code> ) ġ ϸ κи
<code>.htaccess</code> õѴ. ,</p>
<div class="example"><p><code>
DocumentRoot /www/htdocs<br />
<Directory /><br />
<span class="indent">
AllowOverride all<br />
</span>
</Directory>
</code></p></div>
<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>
<h3><a name="negotiation" id="negotiation"></a></h3>
<p>ϰ ¥ ִٸ
´. ̵ Ϻ ۴.
ִ. ϵī带 ϴ :</p>
<div class="example"><p><code>
DirectoryIndex index
</code></p></div>
<p> Ѵ:</p>
<div class="example"><p><code>
DirectoryIndex index.cgi index.pl index.shtml index.html
</code></p></div>
<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>
<h3> (memory-mapping)</h3>
<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>
<h3>Sendfile</h3>
<p>ġ ü <code>sendfile(2)</code> ϸ
Ŀ sendfile Ͽ -- , Ҷ
-- ִ.</p>
<p> ÷ sendfile ϸ read send
ʿ䰡 . sendfile ϸ
ġԵǴ 찡 ִ:</p>
<ul>
<li>
<p>sendfile ߸Ǿ ý
߰ ϴ ÷ ִ. Ư ٸ ǻͿ
Ͽ sendfile ߸ ǻͷ
쿡 ϴ.</p>
</li>
<li>
<p>Ŀ ڽ ij Ͽ NFS Ʈ
찡 ִ.</p>
</li>
</ul>
<p> ǿ شϸ sendfile ʵ
<code>EnableSendfile off</code> ؾ Ѵ. (:
þ 丮 ִ.)</p>
<h3><a name="process" id="process">μ </a></h3>
<p>ġ 1.3 <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>, <code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code>, <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code>
ġũ ū ƴ. Ư ġ ۾
ϱ ڽļ ٴٸ "" Ⱓ
ʿߴ. ó <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code> ڽ
, <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>
ʴ ڽ ϳ . <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code> ⺻
<code>5</code> Ŭ̾Ʈ 100 ÿ ϸ
ϸ óϱ ڽ 95ʰ ɷȴ.
ʴ , 10а
ϴ ġũ ſ ڰ ´.</p>
<p>ʴ Ѱ Ģ ڽ ϸ鼭
ߴ. ǻͰ ڽ ϴ ٻڸ
û . Ģ ġ ü
ɿ ǿ ־ Ͽ. ġ 1.3 ʴ Ѱ
Ģ ȭǾ. ڵ ڽ Ѱ , 1 ,
ΰ , 1 , װ , ̷ ʴ
ڽ 32 鶧 Ѵ. ڽļ <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code> ٴٸ
ߴѴ.</p>
<p> ӵ <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>, <code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code>, <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code> ʿ䰡 . ʿ
ڽ 4 ̻ ϸ <code class="directive"><a href="../mod/core.html#errorlog">ErrorLog</a></code> Ѵ. ̷
̸ ϱ ٶ.
<code class="module"><a href="../mod/mod_status.html">mod_status</a></code> ̴.</p>
<p>μ Ͽ <code class="directive"><a href="../mod/mpm_common.html#maxrequestsperchild">MaxRequestsPerChild</a></code>
μ Ѵ. ⺻ ڽĴ ó û
ٴ <code>0</code>̴. <code>30</code>
ſ ִٸ, ʿ䰡
ִ. SunOS Solaris Ѵٸ,
<code>10000</code> ϶.</p>
<p>(keep-alive) Ѵٸ ڽĵ ̹
ῡ ߰ û ٸ ƹ͵ ʱ
ٻڴ. <code class="directive"><a href="../mod/core.html#keepalivetimeout">KeepAliveTimeout</a></code>
⺻ <code>15</code> ʴ ̷ ּȭѴ. Ʈ
뿪 ڿ ° Ѵ. <a href="http://www.research.digital.com/wrl/techreports/abstracts/95.4.html">
κ </a> 쿡
<code>60</code> ̻ ø .</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="compiletime" id="compiletime">Ͻ ؼ</a></h2>
<h3>MPM </h3>
<p>ġ 2.x <a href="../mpm.html">ó</a>
(MPMs)̶ ü ִ ȭ Ѵ. ġ
Ҷ MPM ؾ Ѵ. <code class="module"><a href="../mod/beos.html">beos</a></code>,
<code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>,
<code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> Ư ÷
ִ MPM ִ. Ϲ н ý MPM
߿ ϳ ִ. ӵ
Ȯ强(scalability) MPM ߳Ŀ ȴ:</p>
<ul>
<li><code class="module"><a href="../mod/worker.html">worker</a></code> MPM ڽ μ
带 Ѵ. ѹ
Ѵ. Ϲ worker prefork MPM
ϹǷ ŷ ϴ.</li>
<li><code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM 尡 Ѱ ڽ
μ Ѵ. μ ѹ
Ѵ. ýۿ prefork ӵ worker
, Ѵ. Ȳ
带 ʴ prefork worker
: 忡 (thread-safe)
ڰ ְ,
÷ ִ.</li>
</ul>
<p> MPM ٸ MPM ڼ MPM <a href="../mpm.html"></a> ϱ ٶ.</p>
<h3><a name="modules" id="modules"></a></h3>
<p> 뷮 ɿ ߿ ̱
ʴ غ. <a href="../dso.html">DSO</a> ߴٸ
<code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code> þ ּóϸ
ȴ. ϰ Ͽ Ʈ ̵
ϴ 캼 ִ.</p>
<p>ݴ ġ Ͽ ũִٸ
ʴ ϱ ġ ؾ
Ѵ.</p>
<p>⼭ 翬 ϰ
ǹ . Ʈ ٸ. Ƹ
<em>ּ</em> <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code>,
<code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code>, <code class="module"><a href="../mod/mod_log_config.html">mod_log_config</a></code>
̴. Ʈ α ʿٸ
<code>mod_log_config</code> ȴ. õ
ʴ´.</p>
<h3>Atomic </h3>
<p><code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code> ֱ
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>
<div class="example"><p><code>
./buildconf<br />
./configure --with-mpm=worker --enable-nonportable-atomics=yes
</code></p></div>
<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>
<h3>mod_status ExtendedStatus On</h3>
<p>ġ Ҷ <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> ϰ
Ҷ <code>ExtendedStatus On</code> ϸ ġ
û <code>gettimeofday(2)</code>(Ȥ ü
<code>times(2)</code>) ι ȣϰ (1.3 )
<code>time(2)</code> ߰ ȣѴ.
۽ð ʿϱ ̴. ֻ
(⺻) <code>ExtendedStatus off</code> Ѵ.</p>
<h3>accept ȭ - </h3>
<div class="warning"><h3>:</h3>
<p> Ʒ ġ 2.0
ʴ. ȿ , ؼ
ϱ ٶ.</p>
</div>
<p>н API Ѵ. Ʈ
Ȥ ּҸ ٸ <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> Ѵٰ .
˻ϱ ġ
<code>select(2)</code> Ѵ. <code>select(2)</code>
Ͽ ٸ ִ <em></em> Ȥ <em>ּ
Ѱ</em> ִ ˷ش. ġ ڽ ְ,
ִ ڽ ÿ ο ˻Ѵ.
ϴ ( ڵ忡 ʾҴ.
ϱ 뵵 .):</p>
<div class="example"><p><code>
for (;;) {<br />
<span class="indent">
for (;;) {<br />
<span class="indent">
fd_set accept_fds;<br />
<br />
FD_ZERO (&accept_fds);<br />
for (i = first_socket; i <= last_socket; ++i) {<br />
<span class="indent">
FD_SET (i, &accept_fds);<br />
</span>
}<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 />
<span class="indent">
if (FD_ISSET (i, &accept_fds)) {<br />
<span class="indent">
new_connection = accept (i, NULL, NULL);<br />
if (new_connection != -1) break;<br />
</span>
}<br />
</span>
}<br />
if (new_connection != -1) break;<br />
</span>
}<br />
process the new_connection;<br />
</span>
}
</code></p></div>
<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>
<div class="example"><p><code>
for (;;) {<br />
<span class="indent">
<strong>accept_mutex_on ();</strong><br />
for (;;) {<br />
<span class="indent">
fd_set accept_fds;<br />
<br />
FD_ZERO (&accept_fds);<br />
for (i = first_socket; i <= last_socket; ++i) {<br />
<span class="indent">
FD_SET (i, &accept_fds);<br />
</span>
}<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 />
<span class="indent">
if (FD_ISSET (i, &accept_fds)) {<br />
<span class="indent">
new_connection = accept (i, NULL, NULL);<br />
if (new_connection != -1) break;<br />
</span>
}<br />
</span>
}<br />
if (new_connection != -1) break;<br />
</span>
}<br />
<strong>accept_mutex_off ();</strong><br />
process the new_connection;<br />
</span>
}
</code></p></div>
<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) ʱ, ̷
ŰĿ <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> þ ϸ
ϴ.</p>
<p> <code class="directive"><a href="../mod/mpm_common.html#acceptmutex">AcceptMutex</a></code> þ Ͽ
mutex ִ.</p>
<dl>
<dt><code>AcceptMutex flock</code></dt>
<dd>
<p> ױ <code>flock(2)</code>
ýȣ Ѵ ( ġ <code class="directive"><a href="../mod/mpm_common.html#lockfile">LockFile</a></code> þ ).</p>
</dd>
<dt><code>AcceptMutex fcntl</code></dt>
<dd>
<p> ױ <code>fcntl(2)</code>
ýȣ Ѵ ( ġ <code class="directive"><a href="../mod/mpm_common.html#lockfile">LockFile</a></code> þ ).</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>ֻ ؼ <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> ʴ
̴̻. Ѵ.</p>
<h3>accept ȭ - Ѱ</h3>
<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>
<h3>Close (lingering)</h3>
<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>
<div class="example"><p><code>
void lingering_close (int s)<br />
{<br />
<span class="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 />
<span class="indent">
select (s for reading, 2 second timeout);<br />
if (error) break;<br />
if (s is ready for reading) {<br />
<span class="indent">
if (read (s, junk_buffer, sizeof (junk_buffer)) <= 0) {<br />
<span class="indent">
break;<br />
</span>
}<br />
/* just toss away whatever is here */<br />
</span>
}<br />
</span>
}<br />
<br />
close (s);<br />
</span>
}
</code></p></div>
<p> ڵ CPU ,
ʿϴ. HTTP/1.1 θ
Ѵٸ(persistent), û
óϸ鼭 ̴. ϰԵ
<code>NO_LINGCLOSE</code> Ͽ
, ʴ´. Ư HTTP/1.1
<span class="transnote">(<em>;</em> ¿ ٸ
ʰ û )</span>
<code>lingering_close</code> ʼ̴ ( <a href="http://www.w3.org/Protocols/HTTP/Performance/Pipeline.html">
</a> ϱ ٶ ̴).</p>
<h3>Scoreboard </h3>
<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>
<div class="note"> : ġ ġ 1.2
ϱ ߴ. ʱ ġ
ŷڵ ̴.</div>
<h3>DYNAMIC_MODULE_LIMIT</h3>
<p> о ʴ´ٸ ( ̶
̱ д´ٸ Ƹ
о ̴), Ҷ
<code>-DDYNAMIC_MODULE_LIMIT=0</code> ߰Ѵ.
о̱ Ҵϴ Ѵ.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="trace" id="trace">η: ýȣ ڼ мϱ</a></h2>
<p> Solaris 8 worker MPM ġ 2.0.38
ýȣ (trace)̴. Ʒ ɾ Ͽ
:</p>
<div class="example"><p><code>
truss -l -p <var>httpd_child_pid</var>.
</code></p></div>
<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>
<div class="example"><pre>/67: accept(3, 0x00200BEC, 0x00200C0C, 1) (sleeping...)
/67: accept(3, 0x00200BEC, 0x00200C0C, 1) = 9</pre></div>
<p> (listener) 尡 LWP #67
ִ.</p>
<div class="note"><code>accept(2)</code> ȭ ָ϶.
Ʈ ٸʴ ÷ worker MPM
⺻ ȭ accept Ѵ.</div>
<div class="example"><pre>/65: lwp_park(0x00000000, 0) = 0
/67: lwp_unpark(65, 1) = 0</pre></div>
<p> Ƶ̰(accept)
worker 带 û óϰ Ѵ. Ʒ Ͽ
û óϴ worker 尡 LWP #65 ִ.</p>
<div class="example"><pre>/65: getsockname(9, 0x00200BA4, 0x00200BC4, 1) = 0</pre></div>
<p>ȣƮ ϱ ġ Ƶ
(local) ּҸ ˾ƾ Ѵ. (ȣƮ
ʰų <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code>
þ ϵī ּҸ )
ȣ ִ. ̷ ȭ ۾
ȵִ. </p>
<div class="example"><pre>/65: brk(0x002170E8) = 0
/65: brk(0x002190E8) = 0</pre></div>
<p><code>brk(2)</code> ȣ (heap) ҴѴ.
κ û ó ü
Ҵ(<code>apr_pool</code> <code>apr_bucket_alloc</code>)
ϱ ýȣ Ͽ ýȣ Ⱑ
幰. Ͽ ڸ ü Ҵڰ
<code>malloc(3)</code> ȣѴ.</p>
<div class="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></div>
<p> worker Ŭ̾Ʈ (ϱ 9)
(non-blocking) · ٲ۴. <code>setsockopt(2)</code>
<code>getsockopt(2)</code> ȣ Solaris libc Ͽ
<code>fcntl(2)</code> óϴ ش.</p>
<div class="example"><pre>/65: read(9, " G E T / 1 0 k . h t m".., 8000) = 97</pre></div>
<p>worker Ŭ̾Ʈ û д´.</p>
<div class="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></div>
<p> <code>Options FollowSymLinks</code>
<code>AllowOverride None</code>̴. û ϰ
丮 <code>lstat(2)</code>ϰų
<code>.htaccess</code> ˻ ʿ䰡 .
˻ϱ, 1) ִ, 2) 丮 ƴ Ϲ,
<code>stat(2)</code> ȣ⸸ ϸ ȴ.</p>
<div class="example"><pre>/65: sendfilev(0, 9, 0x00200F90, 2, 0xFAF7B53C) = 10269</pre></div>
<p> ѹ <code>sendfilev(2)</code> ýȣ
HTTP û ִ. Sendfile δ
ü ٸ. ٸ ý̶ <code>sendfile(2)</code>
ȣϱ <code>write(2)</code>
<code>writev(2)</code> ȣ Ѵ.</p>
<div class="example"><pre>/65: write(4, " 1 2 7 . 0 . 0 . 1 - ".., 78) = 78</pre></div>
<p><code>write(2)</code> ȣ ٷα(access log) û
Ѵ. Ͽ <code>time(2)</code> ȣ ָ϶.
ġ 1.3 ġ 2.0 ð ˱
<code>gettimeofday(3)</code> Ѵ.
<code>gettimeofday</code> ȭ Solaris
ü Ϲ ýȣ δ .</p>
<div class="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></div>
<p>worker ݱ(lingering close)Ѵ.</p>
<div class="example"><pre>/65: close(10) = 0
/65: lwp_park(0x00000000, 0) (sleeping...)</pre></div>
<p> worker ݰ,
(listener) 尡 ٸ Ҵ
Ѵ.</p>
<div class="example"><pre>/67: accept(3, 0x001FEB74, 0x001FEB94, 1) (sleeping...)</pre></div>
<p> ( worker ۾̸
带 ߴ worker MPM 帧 ɿ )
worker 忡 Ҵڸ ٸ Ƶ ִ.
Ͽ , worker 尡
óϴ <code>accept(2)</code> (û ſ
) Ͼ ִ.</p>
</div></div>
<div class="bottomlang">
<p><span> : </span><a href="../en/misc/perf-tuning.html" hreflang="en" rel="alternate" title="English"> en </a> |
<a href="../fr/misc/perf-tuning.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
<a href="../ko/misc/perf-tuning.html" title="Korean"> ko </a> |
<a href="../tr/misc/perf-tuning.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
</div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
<script type="text/javascript"><!--//--><![CDATA[//><!--
var comments_shortname = 'httpd';
var comments_identifier = 'http://httpd.apache.org/docs/2.4/misc/perf-tuning.html';
(function(w, d) {
if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
d.write('<div id="comments_thread"><\/div>');
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
(d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
}
else {
d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
}
})(window, document);
//--><!]]></script></div><div id="footer">
<p class="apache">Copyright 2015 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<p class="menu"><a href="../mod/"></a> | <a href="../mod/directives.html">þ</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html"></a> | <a href="../sitemap.html">Ʈ</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
if (typeof(prettyPrint) !== 'undefined') {
prettyPrint();
}
//--><!]]></script>
</body></html>
y~or5J={Eeu磝Qk ᯘG{?+]ן?wM3X^歌>{7پK>on\jy Rg/=fOroNVv~Y+ NGuÝHWyw[eQʨSb> >}Gmx[o[<{Ϯ_qFvM IENDB`