diff options
Diffstat (limited to '')
-rw-r--r-- | docs/manual/misc/perf-tuning.html | 17 | ||||
-rw-r--r-- | docs/manual/misc/perf-tuning.html.en | 986 | ||||
-rw-r--r-- | docs/manual/misc/perf-tuning.html.fr.utf8 | 1058 | ||||
-rw-r--r-- | docs/manual/misc/perf-tuning.html.ko.euc-kr | 1006 | ||||
-rw-r--r-- | docs/manual/misc/perf-tuning.html.tr.utf8 | 1021 |
5 files changed, 4088 insertions, 0 deletions
diff --git a/docs/manual/misc/perf-tuning.html b/docs/manual/misc/perf-tuning.html new file mode 100644 index 0000000..38788a4 --- /dev/null +++ b/docs/manual/misc/perf-tuning.html @@ -0,0 +1,17 @@ +# GENERATED FROM XML -- DO NOT EDIT + +URI: perf-tuning.html.en +Content-Language: en +Content-type: text/html; charset=ISO-8859-1 + +URI: perf-tuning.html.fr.utf8 +Content-Language: fr +Content-type: text/html; charset=UTF-8 + +URI: perf-tuning.html.ko.euc-kr +Content-Language: ko +Content-type: text/html; charset=EUC-KR + +URI: perf-tuning.html.tr.utf8 +Content-Language: tr +Content-type: text/html; charset=UTF-8 diff --git a/docs/manual/misc/perf-tuning.html.en b/docs/manual/misc/perf-tuning.html.en new file mode 100644 index 0000000..a2b3fdc --- /dev/null +++ b/docs/manual/misc/perf-tuning.html.en @@ -0,0 +1,986 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!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="en" xml:lang="en"><head> +<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" /> +<!-- + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + This file is generated from xml source: DO NOT EDIT + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + --> +<title>Apache Performance Tuning - 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/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p> +<p class="apache">Apache HTTP Server Version 2.4</p> +<img alt="" src="../images/feather.png" /></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>Apache Performance Tuning</h1> +<div class="toplang"> +<p><span>Available Languages: </span><a href="../en/misc/perf-tuning.html" 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" hreflang="ko" rel="alternate" title="Korean"> ko </a> | +<a href="../tr/misc/perf-tuning.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p> +</div> + + + <p>Apache 2.x is a general-purpose webserver, designed to + provide a balance of flexibility, portability, and performance. + Although it has not been designed specifically to set benchmark + records, Apache 2.x is capable of high performance in many + real-world situations.</p> + + <p>Compared to Apache 1.3, release 2.x contains many additional + optimizations to increase throughput and scalability. Most of + these improvements are enabled by default. However, there are + compile-time and run-time configuration choices that can + significantly affect performance. This document describes the + options that a server administrator can configure to tune the + performance of an Apache 2.x installation. Some of these + configuration options enable the httpd to better take advantage + of the capabilities of the hardware and OS, while others allow + the administrator to trade functionality for speed.</p> + + </div> +<div id="quickview"><a href="https://www.apache.org/foundation/contributing.html" class="badge"><img src="https://www.apache.org/images/SupportApache-small.png" alt="Support Apache!" /></a><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#hardware">Hardware and Operating System Issues</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#runtime">Run-Time Configuration Issues</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#compiletime">Compile-Time Configuration Issues</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#trace">Appendix: Detailed Analysis of a Trace</a></li> +</ul><h3>See also</h3><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">Hardware and Operating System Issues</a></h2> + + + + <p>The single biggest hardware issue affecting webserver + performance is RAM. A webserver should never ever have to swap, + as swapping increases the latency of each request beyond a point + that users consider "fast enough". This causes users to hit + stop and reload, further increasing the load. You can, and + should, control the <code class="directive"><a href="../mod/mpm_common.html#maxrequestworkers">MaxRequestWorkers</a></code> setting so that your server + does not spawn so many children that it starts swapping. The procedure + for doing this is simple: determine the size of your average Apache + process, by looking at your process list via a tool such as + <code>top</code>, and divide this into your total available memory, + leaving some room for other processes.</p> + + <p>Beyond that the rest is mundane: get a fast enough CPU, a + fast enough network card, and fast enough disks, where "fast + enough" is something that needs to be determined by + experimentation.</p> + + <p>Operating system choice is largely a matter of local + concerns. But some guidelines that have proven generally + useful are:</p> + + <ul> + <li> + <p>Run the latest stable release and patch level of the + operating system that you choose. Many OS suppliers have + introduced significant performance improvements to their + TCP stacks and thread libraries in recent years.</p> + </li> + + <li> + <p>If your OS supports a <code>sendfile(2)</code> system + call, make sure you install the release and/or patches + needed to enable it. (With Linux, for example, this means + using Linux 2.4 or later. For early releases of Solaris 8, + you may need to apply a patch.) On systems where it is + available, <code>sendfile</code> enables Apache 2 to deliver + static content faster and with lower CPU utilization.</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">Run-Time Configuration Issues</a></h2> + + + + <table class="related"><tr><th>Related Modules</th><th>Related Directives</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 and other DNS considerations</a></h3> + + + + <p>Prior to Apache 1.3, <code class="directive"><a href="../mod/core.html#hostnamelookups">HostnameLookups</a></code> defaulted to <code>On</code>. + This adds latency to every request because it requires a + DNS lookup to complete before the request is finished. In + Apache 1.3 this setting defaults to <code>Off</code>. If you need + to have addresses in your log files resolved to hostnames, use the + <code class="program"><a href="../programs/logresolve.html">logresolve</a></code> + program that comes with Apache, or one of the numerous log + reporting packages which are available.</p> + + <p>It is recommended that you do this sort of postprocessing of + your log files on some machine other than the production web + server machine, in order that this activity not adversely affect + server performance.</p> + + <p>If you use any <code><code class="directive"><a href="../mod/mod_access_compat.html#allow">Allow</a></code> from domain</code> or <code><code class="directive"><a href="../mod/mod_access_compat.html#deny">Deny</a></code> from domain</code> + directives (i.e., using a hostname, or a domain name, rather than + an IP address) then you will pay for + two DNS lookups (a reverse, followed by a forward lookup + to make sure that the reverse is not being spoofed). For best + performance, therefore, use IP addresses, rather than names, when + using these directives, if possible.</p> + + <p>Note that it's possible to scope the directives, such as + within a <code><Location "/server-status"></code> section. + In this case the DNS lookups are only performed on requests + matching the criteria. Here's an example which disables lookups + except for <code>.html</code> and <code>.cgi</code> files:</p> + + <pre class="prettyprint lang-config">HostnameLookups off +<Files ~ "\.(html|cgi)$"> + HostnameLookups on +</Files></pre> + + + <p>But even still, if you just need DNS names in some CGIs you + could consider doing the <code>gethostbyname</code> call in the + specific CGIs that need it.</p> + + + + <h3><a name="symlinks" id="symlinks">FollowSymLinks and SymLinksIfOwnerMatch</a></h3> + + + + <p>Wherever in your URL-space you do not have an <code>Options + FollowSymLinks</code>, or you do have an <code>Options + SymLinksIfOwnerMatch</code>, Apache will need to issue extra + system calls to check up on symlinks. (One extra call per + filename component.) For example, if you had:</p> + + <pre class="prettyprint lang-config">DocumentRoot "/www/htdocs" +<Directory "/"> + Options SymLinksIfOwnerMatch +</Directory></pre> + + + <p>and a request is made for the URI <code>/index.html</code>, + then Apache will perform <code>lstat(2)</code> on + <code>/www</code>, <code>/www/htdocs</code>, and + <code>/www/htdocs/index.html</code>. The results of these + <code>lstats</code> are never cached, so they will occur on + every single request. If you really desire the symlinks + security checking, you can do something like this:</p> + + <pre class="prettyprint lang-config">DocumentRoot "/www/htdocs" +<Directory "/"> + Options FollowSymLinks +</Directory> + +<Directory "/www/htdocs"> + Options -FollowSymLinks +SymLinksIfOwnerMatch +</Directory></pre> + + + <p>This at least avoids the extra checks for the + <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> path. + Note that you'll need to add similar sections if you + have any <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code> or + <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> paths + outside of your document root. For highest performance, + and no symlink protection, set <code>FollowSymLinks</code> + everywhere, and never set <code>SymLinksIfOwnerMatch</code>.</p> + + + + <h3><a name="htaccess" id="htaccess">AllowOverride</a></h3> + + + + <p>Wherever in your URL-space you allow overrides (typically + <code>.htaccess</code> files), Apache will attempt to open + <code>.htaccess</code> for each filename component. For + example,</p> + + <pre class="prettyprint lang-config">DocumentRoot "/www/htdocs" +<Directory "/"> + AllowOverride all +</Directory></pre> + + + <p>and a request is made for the URI <code>/index.html</code>. + Then Apache will attempt to open <code>/.htaccess</code>, + <code>/www/.htaccess</code>, and + <code>/www/htdocs/.htaccess</code>. The solutions are similar + to the previous case of <code>Options FollowSymLinks</code>. + For highest performance use <code>AllowOverride None</code> + everywhere in your filesystem.</p> + + + + <h3><a name="negotiation" id="negotiation">Negotiation</a></h3> + + + + <p>If at all possible, avoid content negotiation if you're + really interested in every last ounce of performance. In + practice the benefits of negotiation outweigh the performance + penalties. There's one case where you can speed up the server. + Instead of using a wildcard such as:</p> + + <pre class="prettyprint lang-config">DirectoryIndex index</pre> + + + <p>Use a complete list of options:</p> + + <pre class="prettyprint lang-config">DirectoryIndex index.cgi index.pl index.shtml index.html</pre> + + + <p>where you list the most common choice first.</p> + + <p>Also note that explicitly creating a <code>type-map</code> + file provides better performance than using + <code>MultiViews</code>, as the necessary information can be + determined by reading this single file, rather than having to + scan the directory for files.</p> + + <p>If your site needs content negotiation, consider using + <code>type-map</code> files, rather than the <code>Options + MultiViews</code> directive to accomplish the negotiation. See the + <a href="../content-negotiation.html">Content Negotiation</a> + documentation for a full discussion of the methods of negotiation, + and instructions for creating <code>type-map</code> files.</p> + + + + <h3>Memory-mapping</h3> + + + + <p>In situations where Apache 2.x needs to look at the contents + of a file being delivered--for example, when doing server-side-include + processing--it normally memory-maps the file if the OS supports + some form of <code>mmap(2)</code>.</p> + + <p>On some platforms, this memory-mapping improves performance. + However, there are cases where memory-mapping can hurt the performance + or even the stability of the httpd:</p> + + <ul> + <li> + <p>On some operating systems, <code>mmap</code> does not scale + as well as <code>read(2)</code> when the number of CPUs increases. + On multiprocessor Solaris servers, for example, Apache 2.x sometimes + delivers server-parsed files faster when <code>mmap</code> is disabled.</p> + </li> + + <li> + <p>If you memory-map a file located on an NFS-mounted filesystem + and a process on another NFS client machine deletes or truncates + the file, your process may get a bus error the next time it tries + to access the mapped file content.</p> + </li> + </ul> + + <p>For installations where either of these factors applies, you + should use <code>EnableMMAP off</code> to disable the memory-mapping + of delivered files. (Note: This directive can be overridden on + a per-directory basis.)</p> + + + + <h3>Sendfile</h3> + + + + <p>In situations where Apache 2.x can ignore the contents of the file + to be delivered -- for example, when serving static file content -- + it normally uses the kernel sendfile support for the file if the OS + supports the <code>sendfile(2)</code> operation.</p> + + <p>On most platforms, using sendfile improves performance by eliminating + separate read and send mechanics. However, there are cases where using + sendfile can harm the stability of the httpd:</p> + + <ul> + <li> + <p>Some platforms may have broken sendfile support that the build + system did not detect, especially if the binaries were built on + another box and moved to such a machine with broken sendfile support.</p> + </li> + <li> + <p>With an NFS-mounted filesystem, the kernel may be unable + to reliably serve the network file through its own cache.</p> + </li> + </ul> + + <p>For installations where either of these factors applies, you + should use <code>EnableSendfile off</code> to disable sendfile + delivery of file contents. (Note: This directive can be overridden + on a per-directory basis.)</p> + + + + <h3><a name="process" id="process">Process Creation</a></h3> + + + + <p>Prior to Apache 1.3 the <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>, <code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code>, and <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code> settings all had drastic effects on + benchmark results. In particular, Apache required a "ramp-up" + period in order to reach a number of children sufficient to serve + the load being applied. After the initial spawning of + <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code> children, + only one child per second would be created to satisfy the + <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code> + setting. So a server being accessed by 100 simultaneous + clients, using the default <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code> of <code>5</code> would take on + the order of 95 seconds to spawn enough children to handle + the load. This works fine in practice on real-life servers + because they aren't restarted frequently. But it does really + poorly on benchmarks which might only run for ten minutes.</p> + + <p>The one-per-second rule was implemented in an effort to + avoid swamping the machine with the startup of new children. If + the machine is busy spawning children, it can't service + requests. But it has such a drastic effect on the perceived + performance of Apache that it had to be replaced. As of Apache + 1.3, the code will relax the one-per-second rule. It will spawn + one, wait a second, then spawn two, wait a second, then spawn + four, and it will continue exponentially until it is spawning + 32 children per second. It will stop whenever it satisfies the + <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code> + setting.</p> + + <p>This appears to be responsive enough that it's almost + unnecessary to twiddle the <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>, <code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code> and <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code> knobs. When more than 4 children are + spawned per second, a message will be emitted to the + <code class="directive"><a href="../mod/core.html#errorlog">ErrorLog</a></code>. If you + see a lot of these errors, then consider tuning these settings. + Use the <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> output as a guide.</p> + + <p>Related to process creation is process death induced by the + <code class="directive"><a href="../mod/mpm_common.html#maxconnectionsperchild">MaxConnectionsPerChild</a></code> + setting. By default this is <code>0</code>, + which means that there is no limit to the number of connections + handled per child. If your configuration currently has this set + to some very low number, such as <code>30</code>, you may want to bump this + up significantly. If you are running SunOS or an old version of + Solaris, limit this to <code>10000</code> or so because of memory leaks.</p> + + <p>When keep-alives are in use, children will be kept busy + doing nothing waiting for more requests on the already open + connection. The default <code class="directive"><a href="../mod/core.html#keepalivetimeout">KeepAliveTimeout</a></code> of <code>5</code> + seconds attempts to minimize this effect. The tradeoff here is + between network bandwidth and server resources. In no event + should you raise this above about <code>60</code> seconds, as <a href="http://www.hpl.hp.com/techreports/Compaq-DEC/WRL-95-4.html"> + most of the benefits are lost</a>.</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">Compile-Time Configuration Issues</a></h2> + + + + <h3>Choosing an MPM</h3> + + + + <p>Apache 2.x supports pluggable concurrency models, called + <a href="../mpm.html">Multi-Processing Modules</a> (MPMs). + When building Apache, you must choose an MPM to use. There + are platform-specific MPMs for some platforms: + <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>, and <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>. For + general Unix-type systems, there are several MPMs from which + to choose. The choice of MPM can affect the speed and scalability + of the httpd:</p> + + <ul> + + <li>The <code class="module"><a href="../mod/worker.html">worker</a></code> MPM uses multiple child + processes with many threads each. Each thread handles + one connection at a time. Worker generally is a good + choice for high-traffic servers because it has a smaller + memory footprint than the prefork MPM.</li> + + <li>The <code class="module"><a href="../mod/event.html">event</a></code> MPM is threaded like the + Worker MPM, but is designed to allow more requests to be + served simultaneously by passing off some processing work + to supporting threads, freeing up the main threads to work + on new requests.</li> + + <li>The <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM uses multiple child + processes with one thread each. Each process handles + one connection at a time. On many systems, prefork is + comparable in speed to worker, but it uses more memory. + Prefork's threadless design has advantages over worker + in some situations: it can be used with non-thread-safe + third-party modules, and it is easier to debug on platforms + with poor thread debugging support.</li> + + </ul> + + <p>For more information on these and other MPMs, please + see the MPM <a href="../mpm.html">documentation</a>.</p> + + + + <h3><a name="modules" id="modules">Modules</a></h3> + + + + <p>Since memory usage is such an important consideration in + performance, you should attempt to eliminate modules that you are + not actually using. If you have built the modules as <a href="../dso.html">DSOs</a>, eliminating modules is a simple + matter of commenting out the associated <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code> directive for that module. + This allows you to experiment with removing modules and seeing + if your site still functions in their absence.</p> + + <p>If, on the other hand, you have modules statically linked + into your Apache binary, you will need to recompile Apache in + order to remove unwanted modules.</p> + + <p>An associated question that arises here is, of course, what + modules you need, and which ones you don't. The answer here + will, of course, vary from one web site to another. However, the + <em>minimal</em> list of modules which you can get by with tends + to include <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>, + and <code class="module"><a href="../mod/mod_log_config.html">mod_log_config</a></code>. <code>mod_log_config</code> is, + of course, optional, as you can run a web site without log + files. This is, however, not recommended.</p> + + + + <h3>Atomic Operations</h3> + + + + <p>Some modules, such as <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code> and + recent development builds of the worker MPM, use APR's + atomic API. This API provides atomic operations that can + be used for lightweight thread synchronization.</p> + + <p>By default, APR implements these operations using the + most efficient mechanism available on each target + OS/CPU platform. Many modern CPUs, for example, have + an instruction that does an atomic compare-and-swap (CAS) + operation in hardware. On some platforms, however, APR + defaults to a slower, mutex-based implementation of the + atomic API in order to ensure compatibility with older + CPU models that lack such instructions. If you are + building Apache for one of these platforms, and you plan + to run only on newer CPUs, you can select a faster atomic + implementation at build time by configuring Apache with + the <code>--enable-nonportable-atomics</code> option:</p> + + <div class="example"><p><code> + ./buildconf<br /> + ./configure --with-mpm=worker --enable-nonportable-atomics=yes + </code></p></div> + + <p>The <code>--enable-nonportable-atomics</code> option is + relevant for the following platforms:</p> + + <ul> + + <li>Solaris on SPARC<br /> + By default, APR uses mutex-based atomics on Solaris/SPARC. + If you configure with <code>--enable-nonportable-atomics</code>, + however, APR generates code that uses a SPARC v8plus opcode for + fast hardware compare-and-swap. If you configure Apache with + this option, the atomic operations will be more efficient + (allowing for lower CPU utilization and higher concurrency), + but the resulting executable will run only on UltraSPARC + chips. + </li> + + <li>Linux on x86<br /> + By default, APR uses mutex-based atomics on Linux. If you + configure with <code>--enable-nonportable-atomics</code>, + however, APR generates code that uses a 486 opcode for fast + hardware compare-and-swap. This will result in more efficient + atomic operations, but the resulting executable will run only + on 486 and later chips (and not on 386). + </li> + + </ul> + + + + <h3>mod_status and ExtendedStatus On</h3> + + + + <p>If you include <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> and you also set + <code>ExtendedStatus On</code> when building and running + Apache, then on every request Apache will perform two calls to + <code>gettimeofday(2)</code> (or <code>times(2)</code> + depending on your operating system), and (pre-1.3) several + extra calls to <code>time(2)</code>. This is all done so that + the status report contains timing indications. For highest + performance, set <code>ExtendedStatus off</code> (which is the + default).</p> + + + + <h3>accept Serialization - Multiple Sockets</h3> + + + + <div class="warning"><h3>Warning:</h3> + <p>This section has not been fully updated + to take into account changes made in the 2.x version of the + Apache HTTP Server. Some of the information may still be + relevant, but please use it with care.</p> + </div> + + <p>This discusses a shortcoming in the Unix socket API. Suppose + your web server uses multiple <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> statements to listen on either multiple + ports or multiple addresses. In order to test each socket + to see if a connection is ready, Apache uses + <code>select(2)</code>. <code>select(2)</code> indicates that a + socket has <em>zero</em> or <em>at least one</em> connection + waiting on it. Apache's model includes multiple children, and + all the idle ones test for new connections at the same time. A + naive implementation looks something like this (these examples + do not match the code, they're contrived for pedagogical + purposes):</p> + + <pre class="prettyprint lang-c"> for (;;) { + for (;;) { + fd_set accept_fds; + + FD_ZERO (&accept_fds); + for (i = first_socket; i <= last_socket; ++i) { + FD_SET (i, &accept_fds); + } + rc = select (last_socket+1, &accept_fds, NULL, NULL, NULL); + if (rc < 1) continue; + new_connection = -1; + for (i = first_socket; i <= last_socket; ++i) { + if (FD_ISSET (i, &accept_fds)) { + new_connection = accept (i, NULL, NULL); + if (new_connection != -1) break; + } + } + if (new_connection != -1) break; + } + process_the(new_connection); + }</pre> + + + <p>But this naive implementation has a serious starvation problem. + Recall that multiple children execute this loop at the same + time, and so multiple children will block at + <code>select</code> when they are in between requests. All + those blocked children will awaken and return from + <code>select</code> when a single request appears on any socket. + (The number of children which awaken varies depending on the + operating system and timing issues.) They will all then fall + down into the loop and try to <code>accept</code> the + connection. But only one will succeed (assuming there's still + only one connection ready). The rest will be <em>blocked</em> + in <code>accept</code>. This effectively locks those children + into serving requests from that one socket and no other + sockets, and they'll be stuck there until enough new requests + appear on that socket to wake them all up. This starvation + problem was first documented in <a href="http://bugs.apache.org/index/full/467">PR#467</a>. There + are at least two solutions.</p> + + <p>One solution is to make the sockets non-blocking. In this + case the <code>accept</code> won't block the children, and they + will be allowed to continue immediately. But this wastes CPU + time. Suppose you have ten idle children in + <code>select</code>, and one connection arrives. Then nine of + those children will wake up, try to <code>accept</code> the + connection, fail, and loop back into <code>select</code>, + accomplishing nothing. Meanwhile none of those children are + servicing requests that occurred on other sockets until they + get back up to the <code>select</code> again. Overall this + solution does not seem very fruitful unless you have as many + idle CPUs (in a multiprocessor box) as you have idle children + (not a very likely situation).</p> + + <p>Another solution, the one used by Apache, is to serialize + entry into the inner loop. The loop looks like this + (differences highlighted):</p> + + <pre class="prettyprint lang-c"> for (;;) { + <strong>accept_mutex_on ();</strong> + for (;;) { + fd_set accept_fds; + + FD_ZERO (&accept_fds); + for (i = first_socket; i <= last_socket; ++i) { + FD_SET (i, &accept_fds); + } + rc = select (last_socket+1, &accept_fds, NULL, NULL, NULL); + if (rc < 1) continue; + new_connection = -1; + for (i = first_socket; i <= last_socket; ++i) { + if (FD_ISSET (i, &accept_fds)) { + new_connection = accept (i, NULL, NULL); + if (new_connection != -1) break; + } + } + if (new_connection != -1) break; + } + <strong>accept_mutex_off ();</strong> + process the new_connection; + }</pre> + + + <p><a id="serialize" name="serialize">The functions</a> + <code>accept_mutex_on</code> and <code>accept_mutex_off</code> + implement a mutual exclusion semaphore. Only one child can have + the mutex at any time. There are several choices for + implementing these mutexes. The choice is defined in + <code>src/conf.h</code> (pre-1.3) or + <code>src/include/ap_config.h</code> (1.3 or later). Some + architectures do not have any locking choice made, on these + architectures it is unsafe to use multiple + <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> + directives.</p> + + <p>The <code class="directive"><a href="../mod/core.html#mutex">Mutex</a></code> directive can + be used to change the mutex implementation of the + <code>mpm-accept</code> mutex at run-time. Special considerations + for different mutex implementations are documented with that + directive.</p> + + <p>Another solution that has been considered but never + implemented is to partially serialize the loop -- that is, let + in a certain number of processes. This would only be of + interest on multiprocessor boxes where it's possible that multiple + children could run simultaneously, and the serialization + actually doesn't take advantage of the full bandwidth. This is + a possible area of future investigation, but priority remains + low because highly parallel web servers are not the norm.</p> + + <p>Ideally you should run servers without multiple + <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> + statements if you want the highest performance. + But read on.</p> + + + + <h3>accept Serialization - Single Socket</h3> + + + + <p>The above is fine and dandy for multiple socket servers, but + what about single socket servers? In theory they shouldn't + experience any of these same problems because all the children + can just block in <code>accept(2)</code> until a connection + arrives, and no starvation results. In practice this hides + almost the same "spinning" behavior discussed above in the + non-blocking solution. The way that most TCP stacks are + implemented, the kernel actually wakes up all processes blocked + in <code>accept</code> when a single connection arrives. One of + those processes gets the connection and returns to user-space. + The rest spin in the kernel and go back to sleep when they + discover there's no connection for them. This spinning is + hidden from the user-land code, but it's there nonetheless. + This can result in the same load-spiking wasteful behavior + that a non-blocking solution to the multiple sockets case + can.</p> + + <p>For this reason we have found that many architectures behave + more "nicely" if we serialize even the single socket case. So + this is actually the default in almost all cases. Crude + experiments under Linux (2.0.30 on a dual Pentium pro 166 + w/128Mb RAM) have shown that the serialization of the single + socket case causes less than a 3% decrease in requests per + second over unserialized single-socket. But unserialized + single-socket showed an extra 100ms latency on each request. + This latency is probably a wash on long haul lines, and only an + issue on LANs. If you want to override the single socket + serialization, you can define + <code>SINGLE_LISTEN_UNSERIALIZED_ACCEPT</code>, and then + single-socket servers will not serialize at all.</p> + + + + <h3>Lingering Close</h3> + + + + <p>As discussed in <a href="http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-connection-00.txt"> + draft-ietf-http-connection-00.txt</a> section 8, in order for + an HTTP server to <strong>reliably</strong> implement the + protocol, it needs to shut down each direction of the + communication independently. (Recall that a TCP connection is + bi-directional. Each half is independent of the other.)</p> + + <p>When this feature was added to Apache, it caused a flurry of + problems on various versions of Unix because of shortsightedness. + The TCP specification does not state that the <code>FIN_WAIT_2</code> + state has a timeout, but it doesn't prohibit it. + On systems without the timeout, Apache 1.2 induces many sockets + stuck forever in the <code>FIN_WAIT_2</code> state. In many cases this + can be avoided by simply upgrading to the latest TCP/IP patches + supplied by the vendor. In cases where the vendor has never + released patches (<em>i.e.</em>, SunOS4 -- although folks with + a source license can patch it themselves), we have decided to + disable this feature.</p> + + <p>There are two ways to accomplish this. One is the socket + option <code>SO_LINGER</code>. But as fate would have it, this + has never been implemented properly in most TCP/IP stacks. Even + on those stacks with a proper implementation (<em>i.e.</em>, + Linux 2.0.31), this method proves to be more expensive (cputime) + than the next solution.</p> + + <p>For the most part, Apache implements this in a function + called <code>lingering_close</code> (in + <code>http_main.c</code>). The function looks roughly like + this:</p> + + <pre class="prettyprint lang-c"> void lingering_close (int s) + { + char junk_buffer[2048]; + + /* shutdown the sending side */ + shutdown (s, 1); + + signal (SIGALRM, lingering_death); + alarm (30); + + for (;;) { + select (s for reading, 2 second timeout); + if (error) break; + if (s is ready for reading) { + if (read (s, junk_buffer, sizeof (junk_buffer)) <= 0) { + break; + } + /* just toss away whatever is here */ + } + } + + close (s); + }</pre> + + + <p>This naturally adds some expense at the end of a connection, + but it is required for a reliable implementation. As HTTP/1.1 + becomes more prevalent, and all connections are persistent, + this expense will be amortized over more requests. If you want + to play with fire and disable this feature, you can define + <code>NO_LINGCLOSE</code>, but this is not recommended at all. + In particular, as HTTP/1.1 pipelined persistent connections + come into use, <code>lingering_close</code> is an absolute + necessity (and <a href="http://www.w3.org/Protocols/HTTP/Performance/Pipeline.html"> + pipelined connections are faster</a>, so you want to support + them).</p> + + + + <h3>Scoreboard File</h3> + + + + <p>Apache's parent and children communicate with each other + through something called the scoreboard. Ideally this should be + implemented in shared memory. For those operating systems that + we either have access to, or have been given detailed ports + for, it typically is implemented using shared memory. The rest + default to using an on-disk file. The on-disk file is not only + slow, but it is unreliable (and less featured). Peruse the + <code>src/main/conf.h</code> file for your architecture, and + look for either <code>USE_MMAP_SCOREBOARD</code> or + <code>USE_SHMGET_SCOREBOARD</code>. Defining one of those two + (as well as their companions <code>HAVE_MMAP</code> and + <code>HAVE_SHMGET</code> respectively) enables the supplied + shared memory code. If your system has another type of shared + memory, edit the file <code>src/main/http_main.c</code> and add + the hooks necessary to use it in Apache. (Send us back a patch + too, please.)</p> + + <div class="note">Historical note: The Linux port of Apache didn't start to + use shared memory until version 1.2 of Apache. This oversight + resulted in really poor and unreliable behavior of earlier + versions of Apache on Linux.</div> + + + + <h3>DYNAMIC_MODULE_LIMIT</h3> + + + + <p>If you have no intention of using dynamically loaded modules + (you probably don't if you're reading this and tuning your + server for every last ounce of performance), then you should add + <code>-DDYNAMIC_MODULE_LIMIT=0</code> when building your + server. This will save RAM that's allocated only for supporting + dynamically loaded modules.</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">Appendix: Detailed Analysis of a Trace</a></h2> + + + + <p>Here is a system call trace of Apache 2.0.38 with the worker MPM + on Solaris 8. This trace was collected using:</p> + + <div class="example"><p><code> + truss -l -p <var>httpd_child_pid</var>. + </code></p></div> + + <p>The <code>-l</code> option tells truss to log the ID of the + LWP (lightweight process--Solaris' form of kernel-level thread) + that invokes each system call.</p> + + <p>Other systems may have different system call tracing utilities + such as <code>strace</code>, <code>ktrace</code>, or <code>par</code>. + They all produce similar output.</p> + + <p>In this trace, a client has requested a 10KB static file + from the httpd. Traces of non-static requests or requests + with content negotiation look wildly different (and quite ugly + in some cases).</p> + + <div class="example"><pre>/67: accept(3, 0x00200BEC, 0x00200C0C, 1) (sleeping...) +/67: accept(3, 0x00200BEC, 0x00200C0C, 1) = 9</pre></div> + + <p>In this trace, the listener thread is running within LWP #67.</p> + + <div class="note">Note the lack of <code>accept(2)</code> serialization. On this + particular platform, the worker MPM uses an unserialized accept by + default unless it is listening on multiple ports.</div> + + <div class="example"><pre>/65: lwp_park(0x00000000, 0) = 0 +/67: lwp_unpark(65, 1) = 0</pre></div> + + <p>Upon accepting the connection, the listener thread wakes up + a worker thread to do the request processing. In this trace, + the worker thread that handles the request is mapped to LWP #65.</p> + + <div class="example"><pre>/65: getsockname(9, 0x00200BA4, 0x00200BC4, 1) = 0</pre></div> + + <p>In order to implement virtual hosts, Apache needs to know + the local socket address used to accept the connection. It + is possible to eliminate this call in many situations (such + as when there are no virtual hosts, or when + <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> directives + are used which do not have wildcard addresses). But + no effort has yet been made to do these optimizations. </p> + + <div class="example"><pre>/65: brk(0x002170E8) = 0 +/65: brk(0x002190E8) = 0</pre></div> + + <p>The <code>brk(2)</code> calls allocate memory from the heap. + It is rare to see these in a system call trace, because the httpd + uses custom memory allocators (<code>apr_pool</code> and + <code>apr_bucket_alloc</code>) for most request processing. + In this trace, the httpd has just been started, so it must + call <code>malloc(3)</code> to get the blocks of raw memory + with which to create the custom memory allocators.</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>Next, the worker thread puts the connection to the client (file + descriptor 9) in non-blocking mode. The <code>setsockopt(2)</code> + and <code>getsockopt(2)</code> calls are a side-effect of how + Solaris' libc handles <code>fcntl(2)</code> on sockets.</p> + + <div class="example"><pre>/65: read(9, " G E T / 1 0 k . h t m".., 8000) = 97</pre></div> + + <p>The worker thread reads the request from the client.</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>This httpd has been configured with <code>Options FollowSymLinks</code> + and <code>AllowOverride None</code>. Thus it doesn't need to + <code>lstat(2)</code> each directory in the path leading up to the + requested file, nor check for <code>.htaccess</code> files. + It simply calls <code>stat(2)</code> to verify that the file: + 1) exists, and 2) is a regular file, not a directory.</p> + + <div class="example"><pre>/65: sendfilev(0, 9, 0x00200F90, 2, 0xFAF7B53C) = 10269</pre></div> + + <p>In this example, the httpd is able to send the HTTP response + header and the requested file with a single <code>sendfilev(2)</code> + system call. Sendfile semantics vary among operating systems. On some other + systems, it is necessary to do a <code>write(2)</code> or + <code>writev(2)</code> call to send the headers before calling + <code>sendfile(2)</code>.</p> + + <div class="example"><pre>/65: write(4, " 1 2 7 . 0 . 0 . 1 - ".., 78) = 78</pre></div> + + <p>This <code>write(2)</code> call records the request in the + access log. Note that one thing missing from this trace is a + <code>time(2)</code> call. Unlike Apache 1.3, Apache 2.x uses + <code>gettimeofday(3)</code> to look up the time. On some operating + systems, like Linux or Solaris, <code>gettimeofday</code> has an + optimized implementation that doesn't require as much overhead + as a typical system call.</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>The worker thread does a lingering close of the connection.</p> + + <div class="example"><pre>/65: close(10) = 0 +/65: lwp_park(0x00000000, 0) (sleeping...)</pre></div> + + <p>Finally the worker thread closes the file that it has just delivered + and blocks until the listener assigns it another connection.</p> + + <div class="example"><pre>/67: accept(3, 0x001FEB74, 0x001FEB94, 1) (sleeping...)</pre></div> + + <p>Meanwhile, the listener thread is able to accept another connection + as soon as it has dispatched this connection to a worker thread (subject + to some flow-control logic in the worker MPM that throttles the listener + if all the available workers are busy). Though it isn't apparent from + this trace, the next <code>accept(2)</code> can (and usually does, under + high load conditions) occur in parallel with the worker thread's handling + of the just-accepted connection.</p> + + </div></div> +<div class="bottomlang"> +<p><span>Available Languages: </span><a href="../en/misc/perf-tuning.html" 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" hreflang="ko" rel="alternate" 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 2019 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/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- +if (typeof(prettyPrint) !== 'undefined') { + prettyPrint(); +} +//--><!]]></script> +</body></html>
\ No newline at end of file diff --git a/docs/manual/misc/perf-tuning.html.fr.utf8 b/docs/manual/misc/perf-tuning.html.fr.utf8 new file mode 100644 index 0000000..beceb14 --- /dev/null +++ b/docs/manual/misc/perf-tuning.html.fr.utf8 @@ -0,0 +1,1058 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!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="fr" xml:lang="fr"><head> +<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> +<!-- + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + This file is generated from xml source: DO NOT EDIT + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + --> +<title>Optimisation des performances d'Apache - Serveur HTTP Apache 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/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossaire</a> | <a href="../sitemap.html">Plan du site</a></p> +<p class="apache">Serveur HTTP Apache Version 2.4</p> +<img alt="" src="../images/feather.png" /></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/">Serveur HTTP</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.4</a> > <a href="./">Documentations diverses</a></div><div id="page-content"><div id="preamble"><h1>Optimisation des performances d'Apache</h1> +<div class="toplang"> +<p><span>Langues Disponibles: </span><a href="../en/misc/perf-tuning.html" hreflang="en" rel="alternate" title="English"> en </a> | +<a href="../fr/misc/perf-tuning.html" title="Français"> fr </a> | +<a href="../ko/misc/perf-tuning.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> | +<a href="../tr/misc/perf-tuning.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p> +</div> + + + <p>Apache 2.x est un serveur web à usage général, conçu dans un but + d'équilibre entre souplesse, portabilité et performances. Bien que non + conçu dans le seul but d'établir une référence en la matière, + Apache 2.x est capable de hautes performances dans de nombreuses situations + du monde réel.</p> + + <p>Comparée à Apache 1.3, la version 2.x comporte de nombreuses + optimisations supplémentaires permettant d'améliorer le débit du serveur + et sa personnalisation. La plupart de ces améliorations sont activées par + défaut. Cependant, certains choix de configuration à la compilation et à + l'exécution peuvent affecter les performances de manière significative. Ce + document décrit les options qu'un administrateur de serveur peut configurer + pour améliorer les performances d'une installation d'Apache 2.x. Certaines + de ces options de configuration permettent au démon httpd de mieux tirer + parti des possibilités du matériel et du système d'exploitation, tandis + que d'autres permettent à l'administrateur de privilégier la vitesse + par rapport aux fonctionnalités.</p> + + </div> +<div id="quickview"><a href="https://www.apache.org/foundation/contributing.html" class="badge"><img src="https://www.apache.org/images/SupportApache-small.png" alt="Support Apache!" /></a><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#hardware">Problèmes matériels et relatifs au système d'exploitation</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#runtime">Optimisation de la configuration à l'exécution</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#compiletime">Optimisation de la configuration à la compilation</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#trace">Appendice : Analyse détaillée d'une trace</a></li> +</ul><h3>Voir aussi</h3><ul class="seealso"><li><a href="#comments_section">Commentaires</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">Problèmes matériels et relatifs au système d'exploitation</a></h2> + + + + <p>Le principal problème matériel qui affecte les performances du serveur + web est la mémoire vive (RAM). Un serveur web ne devrait jamais avoir à + utiliser le swap, car le swapping augmente le temps de réponse de chaque + requête au delà du point que les utilisateurs considèrent comme + "trop lent". Ceci incite les utilisateurs à cliquer sur "Stop", puis + "Charger à nouveau", ce qui a pour effet d'augmenter encore la charge + du serveur. Vous pouvez, et même devez définir la valeur de la directive + <code class="directive"><a href="../mod/mpm_common.html#maxrequestworkers">MaxRequestWorkers</a></code> de façon à ce que + votre serveur ne lance pas un nombre de processus enfants tel qu'il + commence à faire du swapping. La méthode pour y parvenir est + simple : déterminez la taille de votre processus Apache standard en + consultant votre liste de processus à l'aide d'un outil tel que + <code>top</code>, et divisez votre quantité totale de mémoire disponible + par cette taille, tout en gardant un espace suffisant + pour les autres processus.</p> + + <p>Hormis ce réglage relatif à la mémoire, le reste est trivial : le + processeur, la carte réseau et les disques doivent être suffisamment + rapides, où "suffisamment rapide" doit être déterminé par + l'expérience.</p> + + <p>Le choix du système d'exploitation dépend principalement du + contexte local. Voici cependant quelques conseils qui se sont + généralement avérés utiles :</p> + + <ul> + <li> + <p>Exécutez la dernière version stable et le niveau de patches le + plus haut du système d'exploitation que vous avez choisi. De nombreux + éditeurs de systèmes d'exploitation ont amélioré de manière + significative les performances de leurs piles TCP et de leurs + bibliothèques de thread ces dernières années.</p> + </li> + + <li> + <p>Si votre système d'exploitation possède un appel système + <code>sendfile(2)</code>, assurez-vous d'avoir installé la version + et/ou les patches nécessaires à son activation. (Pour Linux, par + exemple, cela se traduit par Linux 2.4 ou plus. Pour les versions + anciennes de Solaris 8, vous pouvez être amené à appliquer un patch.) + Sur les systèmes où il est disponible, <code>sendfile</code> permet + à Apache 2 de servir les contenus statiques plus rapidement, tout en + induisant une charge CPU inférieure.</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">Optimisation de la configuration à l'exécution</a></h2> + + + + <table class="related"><tr><th>Modules Apparentés</th><th>Directives Apparentées</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 et autres considérations à propos du DNS</a></h3> + + + + <p>Avant Apache 1.3, la directive + <code class="directive"><a href="../mod/core.html#hostnamelookups">HostnameLookups</a></code> était positionnée + par défaut à <code>On</code>. Ce réglage augmente le temps de réponse de + chaque requête car il entraîne une recherche DNS et le traitement de la + requête ne pourra pas être achevé tant que cette recherche ne sera + pas terminée. Avec Apache 1.3, ce réglage est défini par défaut à + <code>Off</code>. Si vous souhaitez que les adresses dans vos fichiers + journaux soient résolues en noms d'hôtes, utilisez le programme + <code class="program"><a href="../programs/logresolve.html">logresolve</a></code> fourni avec Apache, ou un des nombreux + paquets générateurs de rapports sur les journaux disponibles.</p> + + <p>Il est recommandé d'effectuer ce genre de traitement a posteriori + de vos fichiers journaux sur une autre machine que celle qui héberge le + serveur web en production, afin que cette activité n'affecte pas les + performances du serveur.</p> + + <p>Si vous utilisez une directive + <code><code class="directive"><a href="../mod/mod_access_compat.html#allow">Allow</a></code>from domain</code> + ou + <code><code class="directive"><a href="../mod/mod_access_compat.html#deny">Deny</a></code> from domain</code> + (ce qui signifie que vous utilisez un nom d'hôte ou un nom de domaine à + la place d'une adresse IP), vous devrez compter avec deux recherches + DNS (une recherche inverse suivie d'une recherche directe pour + s'assurer que l'adresse IP n'a pas été usurpée). C'est pourquoi il est + préférable, pour améliorer les performances, d'utiliser des adresses IP + plutôt que des noms lorsqu'on utilise ces directives, du moins chaque + fois que c'est possible.</p> + + <p>Notez qu'il est possible de modifier la portée des directives, en les + plaçant par exemple à l'intérieur d'une section + <code><Location "/server-status"></code>. Les recherches DNS ne + seront alors effectuées que pour les requêtes qui satisfont aux critères. + Voici un exemple qui désactive les recherches DNS sauf pour les fichiers + <code>.html</code> et <code>.cgi</code> :</p> + + <pre class="prettyprint lang-config">HostnameLookups off +<Files ~ "\.(html|cgi)$"> + HostnameLookups on +</Files></pre> + + + <p>Mais même dans ce cas, si vous n'avez besoin de noms DNS que dans + certains CGIs, vous pouvez effectuer l'appel à <code>gethostbyname</code> + dans les CGIs spécifiques qui en ont besoin.</p> + + + + <h3><a name="symlinks" id="symlinks">FollowSymLinks et SymLinksIfOwnerMatch</a></h3> + + + + <p>Chaque fois que la ligne <code>Options FollowSymLinks</code> sera + absente, ou que la ligne <code>Options SymLinksIfOwnerMatch</code> sera + présente dans votre espace d'adressage, Apache devra effectuer des + appels système supplémentaires pour vérifier la présence de liens + symboliques. Un appel supplémentaire par élément du chemin du fichier. + Par exemple, si vous avez :</p> + + <pre class="prettyprint lang-config">DocumentRoot "/www/htdocs" +<Directory "/"> + Options SymLinksIfOwnerMatch +</Directory></pre> + + + <p>et si une requête demande l'URI <code>/index.html</code>, Apache + effectuera un appel à <code>lstat(2)</code> pour + <code>/www</code>, <code>/www/htdocs</code>, et + <code>/www/htdocs/index.html</code>. Les résultats de ces appels à + <code>lstat</code> ne sont jamais mis en cache, ils devront donc être + générés à nouveau pour chaque nouvelle requête. Si vous voulez absolument + vérifier la sécurité des liens symboliques, vous pouvez utiliser une + configuration du style :</p> + + <pre class="prettyprint lang-config">DocumentRoot "/www/htdocs" +<Directory "/"> + Options FollowSymLinks +</Directory> + +<Directory "/www/htdocs"> + Options -FollowSymLinks +SymLinksIfOwnerMatch +</Directory></pre> + + + <p>Ceci évite au moins les vérifications supplémentaires pour le chemin + défini par <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>. Notez que + vous devrez ajouter des sections similaires si vous avez des chemins + définis par les directives + <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code> ou + <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> en dehors de + la racine de vos documents. Pour améliorer les performances, et supprimer + toute protection des liens symboliques, ajoutez l'option + <code>FollowSymLinks</code> partout, et n'utilisez jamais l'option + <code>SymLinksIfOwnerMatch</code>.</p> + + + + <h3><a name="htaccess" id="htaccess">AllowOverride</a></h3> + + + + <p>Dans toute partie de votre espace d'adressage où vous autoriserez + la surcharge de la configuration (en général à l'aide de fichiers + <code>.htaccess</code>), Apache va tenter d'ouvrir <code>.htaccess</code> + pour chaque élément du chemin du fichier demandé. Par exemple, si vous + avez : </p> + + <pre class="prettyprint lang-config">DocumentRoot "/www/htdocs" +<Directory "/"> + AllowOverride all +</Directory></pre> + + + <p>et qu'une requête demande l'URI <code>/index.html</code>, Apache + tentera d'ouvrir <code>/.htaccess</code>, <code>/www/.htaccess</code>, + et <code>/www/htdocs/.htaccess</code>. Les solutions sont similaires à + celles évoquées précédemment pour <code>Options FollowSymLinks</code>. + Pour améliorer les performances, utilisez <code>AllowOverride None</code> + pour tous les niveaux de votre espace d'adressage.</p> + + + + <h3><a name="negotiation" id="negotiation">Négociation</a></h3> + + + + <p>Dans la mesure du possible, évitez toute négociation de contenu si + vous tenez au moindre gain en performances. En pratique toutefois, + les bénéfices de la négociation l'emportent souvent sur la diminution + des performances. + Il y a cependant un cas dans lequel vous pouvez accélérer le serveur. + Au lieu d'utiliser une directive générique comme :</p> + + <pre class="prettyprint lang-config">DirectoryIndex index</pre> + + + <p>utilisez une liste explicite d'options :</p> + + <pre class="prettyprint lang-config">DirectoryIndex index.cgi index.pl index.shtml index.html</pre> + + + <p>où vous placez le choix courant en première position.</p> + + <p>Notez aussi que créer explicitement un fichier de + <code>correspondances de type</code> fournit de meilleures performances + que l'utilisation des <code>MultiViews</code>, car les informations + nécessaires peuvent être simplement obtenues en lisant ce fichier, sans + avoir à parcourir le répertoire à la recherche de types de fichiers.</p> + + <p>Par conséquent, si la négociation de contenu est nécessaire pour votre + site, préférez les fichiers de <code>correspondances de type</code> aux + directives <code>Options MultiViews</code> pour mener à bien cette + négociation. Se référer au document sur la + <a href="../content-negotiation.html">Négociation de contenu</a> pour une + description complète des méthodes de négociation, et les instructions + permettant de créer des fichiers de <code>correspondances de type</code>.</p> + + + + <h3>Transfert en mémoire</h3> + + + + <p>Dans les situations où Apache 2.x doit consulter le contenu d'un + fichier en train d'être servi - par exemple à l'occasion du traitement + d'une inclusion côté serveur - il transfère en général le fichier en + mémoire si le système d'exploitation supporte une forme quelconque + de <code>mmap(2)</code>.</p> + + <p>Sur certains systèmes, ce transfert en mémoire améliore les + performances. Dans certains cas, ce transfert peut toutefois les dégrader + et même diminuer la stabilité du démon httpd :</p> + + <ul> + <li> + <p>Dans certains systèmes d'exploitation, <code>mmap</code> devient + moins efficace que <code>read(2)</code> quand le nombre de + processeurs augmente. Sur les serveurs multiprocesseurs sous Solaris, + par exemple, Apache 2.x sert parfois les fichiers consultés par le + serveur plus rapidement quand <code>mmap</code> est désactivé.</p> + </li> + + <li> + <p>Si vous transférez en mémoire un fichier localisé dans un système + de fichiers monté par NFS, et si un processus sur + une autre machine cliente NFS supprime ou tronque le fichier, votre + processus peut rencontrer une erreur de bus la prochaine fois qu'il + essaiera d'accéder au contenu du fichier en mémoire.</p> + </li> + </ul> + + <p>Pour les installations où une de ces situations peut se produire, + vous devez utiliser <code>EnableMMAP off</code> afin de désactiver le + transfert en mémoire des fichiers servis. (Note : il est possible de + passer outre cette directive au niveau de chaque répertoire.)</p> + + + + <h3>Sendfile</h3> + + + + <p>Dans les cas où Apache peut se permettre d'ignorer le contenu du + fichier à servir - par exemple, lorsqu'il sert un contenu de fichier + statique - il utilise en général le support sendfile du noyau si le + système d'exploitation supporte l'opération <code>sendfile(2)</code>.</p> + + <p>Sur la plupart des plateformes, l'utilisation de sendfile améliore + les performances en éliminant les mécanismes de lecture et envoi séparés. + Dans certains cas cependant, l'utilisation de sendfile peut nuire à la + stabilité du démon httpd :</p> + + <ul> + <li> + <p>Certaines plateformes peuvent présenter un support de sendfile + défaillant que la construction du système n'a pas détecté, en + particulier si les binaires ont été construits sur une autre machine + et transférés sur la machine où le support de sendfile est + défaillant.</p> + </li> + <li> + <p>Dans le cas d'un système de fichiers monté + sous NFS, le noyau peut s'avérer incapable de servir + les fichiers réseau de manière fiable depuis + son propre cache.</p> + </li> + </ul> + + <p>Pour les installations où une de ces situations peut se produire, + vous devez utiliser <code>EnableSendfile off</code> afin de désactiver + la mise à disposition de contenus de fichiers par sendfile. (Note : il + est possible de passer outre cette directive au niveau de chaque + répertoire.)</p> + + + + <h3><a name="process" id="process">Process Creation</a></h3> + + + + <p>Avant Apache 1.3, les directives + <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>, + <code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code>, et + <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code> avaient des + effets drastiques sur les performances de référence. En particulier, + Apache avait besoin d'un délai de "montée en puissance" afin d'atteindre + un nombre de processus enfants suffisant pour supporter la charge qui lui + était appliquée. Après le lancement initial des processus enfants par + <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code>, seulement un + processus enfant par seconde était créé afin d'atteindre la valeur de la + directive <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>. Ainsi, + un serveur accédé par 100 clients simultanés et utilisant la valeur par + défaut de <code>5</code> pour la directive + <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code>, nécessitait + environ 95 secondes pour lancer suffisamment de processus enfants + permettant de faire face à la charge. Ceci fonctionne en pratique pour + les serveurs en production, car ils sont rarement redémarrés. Ce n'est + cependant pas le cas pour les tests de référence (benchmarks) où le + serveur ne fonctionne que 10 minutes.</p> + + <p>La règle "un processus par seconde" avait été implémentée afin + d'éviter l'enlisement de la machine dans le démarrage de nouveaux + processus enfants. Pendant que la machine est occupée à lancer des + processus enfants, elle ne peut pas traiter les requêtes. Mais cette + règle impactait tellement la perception des performances d'Apache qu'elle + a dû être remplacée. A partir d'Apache 1.3, le code a assoupli la règle + "un processus par seconde". Il va en lancer un, attendre une seconde, + puis en lancer deux, attendre une seconde, puis en lancer quatre et + ainsi de suite jusqu'à lancer 32 processus. Il s'arrêtera lorsque le + nombre de processus aura atteint la valeur définie par la directive + <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>.</p> + + <p>Ceci s'avère suffisamment réactif pour pouvoir en général se passer + de manipuler les valeurs des directives + <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>, + <code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code> et + <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code>. Lorsque plus de + 4 processus enfants sont lancés par seconde, un message est émis vers + le journal des erreurs. Si vous voyez apparaître souvent ce genre de + message, vous devez vous pencher sur ces réglages. Pour vous guider, + utilisez les informations délivrées par le module + <code class="module"><a href="../mod/mod_status.html">mod_status</a></code>.</p> + + <p>À mettre en relation avec la création de processus, leur destruction + est définie par la valeur de la directive + <code class="directive"><a href="../mod/mpm_common.html#maxconnectionsperchild">MaxConnectionsPerChild</a></code>. Sa valeur + par défaut est <code>0</code>, ce qui signifie qu'il n'y a pas de limite + au nombre de connexions qu'un processus enfant peut traiter. Si votre + configuration actuelle a cette directive réglée à une valeur très basse, + de l'ordre de <code>30</code>, il est conseillé de l'augmenter de manière + significative. Si vous utilisez SunOs ou une ancienne version de Solaris, + utilisez une valeur de l'ordre de <code>10000</code> à cause des fuites + de mémoire.</p> + + <p>Lorsqu'ils sont en mode "keep-alive", les processus enfants sont + maintenus et ne font rien sinon attendre la prochaine requête sur la + connexion déjà ouverte. La valeur par défaut de <code>5</code> de la + directive <code class="directive"><a href="../mod/core.html#keepalivetimeout">KeepAliveTimeout</a></code> tend à + minimiser cet effet. Il faut trouver le bon compromis entre la bande + passante réseau et les ressources du serveur. En aucun cas vous ne devez + choisir une valeur supérieure à <code>60</code> seconds, car + <a href="http://www.hpl.hp.com/techreports/Compaq-DEC/WRL-95-4.html"> + la plupart des bénéfices sont alors perdus</a>.</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">Optimisation de la configuration à la compilation</a></h2> + + + + <h3>Choisir un Module Multi-Processus (MPM)</h3> + + + + <p>Apache 2.x supporte les modèles simultanés enfichables, appelés + <a href="../mpm.html">Modules Multi-Processus</a> (MPMs). Vous devez + choisir un MPM au moment de la construction d'Apache. Certaines + plateformes ont des modules MPM spécifiques : + <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> et + <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>. Sur les systèmes de type Unix, vous avez le + choix entre un grand nombre de modules MPM. Le choix du MPM peut affecter + la vitesse et l'évolutivité du démon httpd :</p> + + <ul> + + <li>Le MPM <code class="module"><a href="../mod/worker.html">worker</a></code> utilise plusieurs processus + enfants possédant chacun de nombreux threads. Chaque thread gère une + seule connexion à la fois. Worker est en général un bon choix pour les + serveurs présentant un traffic important car il possède une empreinte + mémoire plus petite que le MPM prefork.</li> + + <li>Comme le MPM Worker, le MPM <code class="module"><a href="../mod/event.html">event</a></code> utilise + les threads, mais il a été conçu pour traiter davantage de + requêtes simultanément en confiant une partie du travail à des + threads de support, ce qui permet aux threads principaux de + traiter de nouvelles requêtes.</li> + + <li>Le MPM <code class="module"><a href="../mod/prefork.html">prefork</a></code> utilise plusieurs processus enfants + possédant chacun un seul thread. Chaque processus gère une seule + connexion à la fois. Sur de nombreux systèmes, prefork est comparable + en matière de vitesse à worker, mais il utilise plus de mémoire. De par + sa conception sans thread, prefork présente des avantages par rapport à + worker dans certaines situations : il peut être utilisé avec les + modules tiers qui ne supportent pas le threading, et son débogage est plus + aisé sur les platesformes présentant un support du débogage des threads + rudimentaire.</li> + + </ul> + + <p>Pour plus d'informations sur ces deux MPMs et les autres, veuillez + vous référer à la <a href="../mpm.html">documentation sur les + MPM</a>.</p> + + + + <h3><a name="modules" id="modules">Modules</a></h3> + + + + <p>Comme le contrôle de l'utilisation de la mémoire est très important + en matière de performance, il est conseillé d'éliminer les modules que + vous n'utilisez pas vraiment. Si vous avez construit ces modules en + tant que <a href="../dso.html">DSOs</a>, leur élimination consiste + simplement à commenter la directive + <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code> associée à ce + module. Ceci vous permet de vérifier si votre site fonctionne toujours + après la suppression de tel ou tel module.</p> + + <p>Par contre, si les modules que vous voulez supprimer sont liés + statiquement à votre binaire Apache, vous devrez recompiler ce dernier + afin de pouvoir les éliminer.</p> + + <p>La question qui découle de ce qui précède est évidemment de + savoir de quels modules vous avez besoin et desquels vous pouvez vous + passer. La réponse sera bien entendu différente d'un site web à + l'autre. Cependant, la liste <em>minimale</em> de modules nécessaire à + la survie de votre site contiendra certainement + <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> et + <code class="module"><a href="../mod/mod_log_config.html">mod_log_config</a></code>. <code>mod_log_config</code> est bien + entendu optionnel puisque vous pouvez faire fonctionner un site web + en se passant de fichiers journaux ; ceci est cependant + déconseillé.</p> + + + + <h3>Opérations atomiques</h3> + + + + <p>Certains modules, à l'instar de <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code> et des + versions de développement récentes du MPM worker, utilisent l'API + atomique d'APR. Cette API propose des opérations atomiques que l'on + peut utiliser pour alléger la synchronisation des threads.</p> + + <p>Par défaut, APR implémente ces opérations en utilisant les + mécanismes les plus efficaces disponibles sur chaque plateforme cible + (Système d'exploitation et processeur). De nombreux processeurs modernes, + par exemple, possèdent une instruction qui effectue une opération + atomique de type comparaison et échange ou compare-and-swap (CAS) au + niveau matériel. Sur certaines platesformes cependant, APR utilise par + défaut une implémentation de l'API atomique plus lente, basée sur les + mutex, afin d'assurer la compatibilité avec les anciens modèles de + processeurs qui ne possèdent pas ce genre d'instruction. Si vous + construisez Apache pour une de ces platesformes, et ne prévoyez de + l'exécuter que sur des processeurs récents, vous pouvez sélectionner une + implémentation atomique plus rapide à la compilation en utilisant + l'option <code>--enable-nonportable-atomics</code> du + script configure :</p> + + <div class="example"><p><code> + ./buildconf<br /> + ./configure --with-mpm=worker --enable-nonportable-atomics=yes + </code></p></div> + + <p>L'option <code>--enable-nonportable-atomics</code> concerne les + platesformes suivantes :</p> + + <ul> + + <li>Solaris sur SPARC<br /> + Sur Solaris/SPARC, APR utilise par défaut les opérations + atomiques basées sur les mutex. Cependant, si vous ajoutez l'option + <code>--enable-nonportable-atomics</code> au script configure, APR + génère un code qui utilise le code opération SPARC v8plus pour des + opérations de compare-and-swap matériel plus rapides. Si vous + utilisez cette option de configure avec Apache, les opérations + atomiques seront plus efficaces (permettant d'alléger la charge du + processeur et un plus haut niveau de simultanéité), mais + l'exécutable produit ne fonctionnera que sur les processeurs + UltraSPARC. + </li> + + <li>Linux sur x86<br /> + Sous Linux, APR utilise par défaut les opérations atomiques basées + sur les mutex. Cependant, si vous ajoutez l'option + <code>--enable-nonportable-atomics</code> au script configure, + APR générera un code qui utilise un code d'opération du 486 + pour des opérations de compare-and-swap matériel plus rapides. Le + code résultant est plus efficace en matière d'opérations atomiques, + mais l'exécutable produit ne fonctionnera que sur des processeurs + 486 et supérieurs (et non sur des 386). + </li> + + </ul> + + + + <h3>Module mod_status et ExtendedStatus On</h3> + + + + <p>Si vous incluez le module <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> à la + construction d'Apache et ajoutez <code>ExtendedStatus On</code> à sa + configuration, Apache va effectuer pour chaque requête deux appels à + <code>gettimeofday(2)</code> (ou <code>times(2)</code> selon votre + système d'exploitation), et (pour les versions antérieures à 1.3) de + nombreux appels supplémentaires à <code>time(2)</code>. Tous ces + appels sont effectués afin que le rapport de statut puisse contenir + des indications temporelles. Pour améliorer les performances, utilisez + <code>ExtendedStatus off</code> (qui est le réglage par défaut).</p> + + + + <h3>accept Serialization - points de connexion à un programme (sockets) multiples</h3> + + + + <div class="warning"><h3>Mise en garde :</h3> + <p>Cette section n'a pas été totalement mise à jour car elle ne tient pas + compte des changements intervenus dans la version 2.x du Serveur HTTP + Apache. Certaines informations sont encore pertinentes, il vous est + cependant conseillé de les utiliser avec prudence.</p> + </div> + + <p>Ce qui suit est une brève discussion à propos de l'API des sockets + Unix. Supposons que votre serveur web utilise plusieurs directives + <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> afin d'écouter + plusieurs ports ou de multiples adresses. Afin de tester chaque socket + pour voir s'il a une connexion en attente, Apache utilise + <code>select(2)</code>. <code>select(2)</code> indique si un socket a + <em>zéro</em> ou <em>au moins une</em> connexion en attente. Le modèle + d'Apache comporte plusieurs processus enfants, et tous ceux qui sont + inactifs testent la présence de nouvelles connexions au même moment. + Une implémentation rudimentaire de ceci pourrait ressembler à + l'exemple suivant + (ces exemples ne sont pas extraits du code d'Apache, ils ne sont + proposés qu'à des fins pédagogiques) :</p> + + <pre class="prettyprint lang-c"> for (;;) { + for (;;) { + fd_set accept_fds; + + FD_ZERO (&accept_fds); + for (i = first_socket; i <= last_socket; ++i) { + FD_SET (i, &accept_fds); + } + rc = select (last_socket+1, &accept_fds, NULL, NULL, NULL); + if (rc < 1) continue; + new_connection = -1; + for (i = first_socket; i <= last_socket; ++i) { + if (FD_ISSET (i, &accept_fds)) { + new_connection = accept (i, NULL, NULL); + if (new_connection != -1) break; + } + } + if (new_connection != -1) break; + } + process_the(new_connection); + }</pre> + + + <p>Mais cette implémentation rudimentaire présente une sérieuse lacune. + Rappelez-vous que les processus enfants exécutent cette boucle au même + moment ; ils vont ainsi bloquer sur <code>select</code> s'ils se trouvent + entre deux requêtes. Tous ces processus bloqués vont se réactiver et + sortir de <code>select</code> quand une requête va apparaître sur un des + sockets (le nombre de processus enfants qui se réactivent varie en + fonction du système d'exploitation et des réglages de synchronisation). + Ils vont alors tous entrer dans la boucle et tenter un + <code>"accept"</code> de la connexion. Mais seulement un d'entre eux y + parviendra (en supposant qu'il ne reste q'une seule connexion en + attente), les autres vont se bloquer au niveau de <code>accept</code>. + Ceci verrouille vraiment ces processus de telle sorte qu'ils ne peuvent + plus servir de requêtes que par cet unique socket, et il en sera ainsi + jusqu'à ce que suffisamment de nouvelles requêtes apparaissent sur ce + socket pour les réactiver tous. Cette lacune a été documentée pour la + première fois dans + <a href="http://bugs.apache.org/index/full/467">PR#467</a>. Il existe + au moins deux solutions.</p> + + <p>La première consiste à rendre les sockets non blocants. Dans ce cas, + <code>accept</code> ne bloquera pas les processus enfants, et ils + pourront continuer à s'exécuter immédiatement. Mais ceci consomme des + ressources processeur. Supposons que vous ayez dix processus enfants + inactifs dans <code>select</code>, et qu'une connexion arrive. + Neuf des dix processus vont se réactiver, tenter un <code>accept</code> + de la connexion, échouer, et boucler dans <code>select</code>, tout en + n'ayant finalement rien accompli. Pendant ce temps, aucun de ces processus + ne traite les requêtes qui arrivent sur d'autres sockets jusqu'à ce + qu'ils retournent dans <code>select</code>. Finalement, cette solution + ne semble pas très efficace, à moins que vous ne disposiez d'autant de + processeurs inactifs (dans un serveur multiprocesseur) que de processus + enfants inactifs, ce qui n'est pas une situation très courante.</p> + + <p>Une autre solution, celle qu'utilise Apache, consiste à sérialiser les + entrées dans la boucle interne. La boucle ressemble à ceci (les + différences sont mises en surbrillance) :</p> + + <pre class="prettyprint lang-c"> for (;;) { + <strong>accept_mutex_on ();</strong> + for (;;) { + fd_set accept_fds; + + FD_ZERO (&accept_fds); + for (i = first_socket; i <= last_socket; ++i) { + FD_SET (i, &accept_fds); + } + rc = select (last_socket+1, &accept_fds, NULL, NULL, NULL); + if (rc < 1) continue; + new_connection = -1; + for (i = first_socket; i <= last_socket; ++i) { + if (FD_ISSET (i, &accept_fds)) { + new_connection = accept (i, NULL, NULL); + if (new_connection != -1) break; + } + } + if (new_connection != -1) break; + } + <strong>accept_mutex_off ();</strong> + process the new_connection; + }</pre> + + + <p><a id="serialize" name="serialize">Les fonctions</a> + <code>accept_mutex_on</code> et <code>accept_mutex_off</code> + implémentent un sémaphore permettant une exclusion mutuelle. Un seul + processus enfant à la fois peut posséder le mutex. Plusieurs choix se + présentent pour implémenter ces mutex. Ce choix est défini dans + <code>src/conf.h</code> (versions antérieures à 1.3) ou + <code>src/include/ap_config.h</code> (versions 1.3 ou supérieures). + Certaines architectures ne font pas ce choix du mode de verrouillage ; + l'utilisation de directives + <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> multiples sur ces + architectures est donc peu sûr.</p> + + <p>La directive <code class="directive"><a href="../mod/core.html#mutex">Mutex</a></code> permet + de modifier l'implémentation du mutex <code>mpm-accept</code> à + l'exécution. Des considérations spécifiques aux différentes + implémentations de mutex sont documentées avec cette directive.</p> + + <p>Une autre solution qui a été imaginée mais jamais implémentée, consiste + à sérialiser partiellement la boucle -- c'est à dire y faire entrer un + certain nombre de processus. Ceci ne présenterait un intérêt que sur les + machines multiprocesseurs où plusieurs processus enfants peuvent + s'exécuter simultanément, et encore, la sérialisation ne tire pas + vraiment parti de toute la bande passante. C'est une possibilité + d'investigation future, mais demeure de priorité basse car les serveurs + web à architecture hautement parallèle ne sont pas la norme.</p> + + <p>Pour bien faire, vous devriez faire fonctionner votre serveur sans + directives <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> multiples + si vous visez les performances les plus élevées. + Mais lisez ce qui suit.</p> + + + + <h3>accept Serialization - point de connexion à un programme (sockets) unique</h3> + + + + <p>Ce qui précède convient pour les serveurs à sockets multiples, mais + qu'en est-il des serveurs à socket unique ? En théorie, ils ne + devraient pas rencontrer les mêmes problèmes car tous les processus + enfants peuvent se bloquer dans <code>accept(2)</code> jusqu'à ce qu'une + connexion arrive, et ils ne sont pas utilisés à ne rien faire. En + pratique, ceci dissimule un même comportement de bouclage + discuté plus haut dans la solution non-blocante. De la manière dont + sont implémentées les piles TCP, le noyau réactive véritablement tous les + processus bloqués dans <code>accept</code> quand une seule connexion + arrive. Un de ces processus prend la connexion en compte et retourne + dans l'espace utilisateur, les autres bouclant dans l'espace du + noyau et se désactivant quand ils s'aperçoivent qu'il n'y a pas de + connexion pour eux. Ce bouclage est invisible depuis le code de l'espace + utilisateur, mais il est quand-même présent. Ceci peut conduire à la + même augmentation de charge à perte que la solution non blocante au cas + des sockets multiples peut induire.</p> + + <p>Pour cette raison, il apparaît que de nombreuses architectures se + comportent plus "proprement" si on sérialise même dans le cas d'une socket + unique. Il s'agit en fait du comportement par défaut dans la plupart des + cas. Des expériences poussées sous Linux (noyau 2.0.30 sur un + biprocesseur Pentium pro 166 avec 128 Mo de RAM) ont montré que la + sérialisation d'une socket unique provoque une diminution inférieure à 3% + du nombre de requêtes par secondes par rapport au traitement non + sérialisé. Mais le traitement non sérialisé des sockets uniques induit + un temps de réponse supplémentaire de 100 ms pour chaque requête. Ce + temps de réponse est probablement provoqué par une limitation sur les + lignes à haute charge, et ne constitue un problème que sur les réseaux + locaux. Si vous voulez vous passer de la sérialisation des sockets + uniques, vous pouvez définir + <code>SINGLE_LISTEN_UNSERIALIZED_ACCEPT</code> et les + serveurs à socket unique ne pratiqueront plus du tout la + sérialisation.</p> + + + + <h3>Fermeture en prenant son temps (Lingering close)</h3> + + + + <p>Comme discuté dans <a href="http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-connection-00.txt"> + draft-ietf-http-connection-00.txt</a> section 8, pour implémenter de + manière <strong>fiable</strong> le protocole, un serveur HTTP doit fermer + les deux directions d'une communication indépendamment (rappelez-vous + qu'une connexion TCP est bidirectionnelle, chaque direction étant + indépendante de l'autre).</p> + + <p>Quand cette fonctionnalité fut ajoutée à Apache, elle causa une + avalanche de problèmes sur plusieurs versions d'Unix à cause d'une + implémentation à courte vue. La spécification TCP ne précise pas que + l'état <code>FIN_WAIT_2</code> possède un temps de réponse mais elle ne + l'exclut pas. Sur les systèmes qui n'introduisent pas ce temps de + réponse, Apache 1.2 induit de nombreux blocages définitifs de socket + dans l'état <code>FIN_WAIT_2</code>. On peut eviter ceci dans de nombreux + cas tout simplement en mettant à jour TCP/IP avec le dernier patch mis à + disposition par le fournisseur. Dans les cas où le fournisseur n'a + jamais fourni de patch (par exemple, SunOS4 -- bien que les utilisateurs + possédant une license source puissent le patcher eux-mêmes), nous avons + décidé de désactiver cette fonctionnalité.</p> + + <p>Il y a deux méthodes pour arriver à ce résultat. La première est + l'option de socket <code>SO_LINGER</code>. Mais le sort a voulu que cette + solution ne soit jamais implémentée correctement dans la plupart des + piles TCP/IP. Et même dans les rares cas où cette solution a été + implémentée correctement (par exemple Linux 2.0.31), elle se + montre beaucoup plus gourmande (en temps processeur) que la solution + suivante.</p> + + <p>Pour la plus grande partie, Apache implémente cette solution à l'aide + d'une fonction appelée <code>lingering_close</code> (définie dans + <code>http_main.c</code>). La fonction ressemble approximativement à + ceci :</p> + + <pre class="prettyprint lang-c"> void lingering_close (int s) + { + char junk_buffer[2048]; + + /* shutdown the sending side */ + shutdown (s, 1); + + signal (SIGALRM, lingering_death); + alarm (30); + + for (;;) { + select (s for reading, 2 second timeout); + if (error) break; + if (s is ready for reading) { + if (read (s, junk_buffer, sizeof (junk_buffer)) <= 0) { + break; + } + /* just toss away whatever is here */ + } + } + + close (s); + }</pre> + + + <p>Ceci ajoute naturellement un peu de charge à la fin d'une connexion, + mais s'avère nécessaire pour une implémentation fiable. Comme HTTP/1.1 + est de plus en plus présent et que toutes les connexions sont + persistentes, la charge sera amortie par la multiplicité des requêtes. + Si vous voulez jouer avec le feu en désactivant cette fonctionnalité, + vous pouvez définir <code>NO_LINGCLOSE</code>, mais c'est fortement + déconseillé. En particulier, comme les connexions persistantes en + pipeline de HTTP/1.1 commencent à être utilisées, + <code>lingering_close</code> devient une absolue nécessité (et les + <a href="http://www.w3.org/Protocols/HTTP/Performance/Pipeline.html"> + connexions en pipeline sont plus rapides</a> ; vous avez donc tout + intérêt à les supporter).</p> + + + + <h3>Fichier tableau de bord (Scoreboard file)</h3> + + + + <p>Les processus parent et enfants d'Apache communiquent entre eux à + l'aide d'un objet appelé "Tableau de bord" (Scoreboard). Idéalement, cet + échange devrait s'effectuer en mémoire partagée. Pour les systèmes + d'exploitation auxquels nous avons eu accès, ou pour lesquels nous avons + obtenu des informations suffisamment détaillées pour effectuer un + portage, cet échange est en général implémenté en utilisant la mémoire + partagée. Pour les autres, on utilise par défaut un fichier d'échange sur + disque. Le fichier d'échange sur disque est non seulement lent, mais + aussi peu fiable (et propose moins de fonctionnalités). Recherchez dans + le fichier <code>src/main/conf.h</code> correspondant à votre + architecture soit <code>USE_MMAP_SCOREBOARD</code>, soit + <code>USE_SHMGET_SCOREBOARD</code>. La définition de l'un des deux + (ainsi que leurs compagnons respectifs <code>HAVE_MMAP</code> et + <code>HAVE_SHMGET</code>), active le code fourni pour la mémoire + partagée. Si votre système propose une autre solution pour la gestion de + la mémoire partagée, éditez le fichier <code>src/main/http_main.c</code> + et ajoutez la portion de code nécessaire pour pouvoir l'utiliser dans + Apache (Merci de nous envoyer aussi le patch correspondant).</p> + + <div class="note">Note à caractère historique : le portage d'Apache sous Linux + n'utilisait pas la mémoire partagée avant la version 1.2. Ceci entraînait + un comportement très rudimentaire et peu fiable des versions antérieures + d'Apache sous Linux.</div> + + + + <h3>DYNAMIC_MODULE_LIMIT</h3> + + + + <p>Si vous n'avez pas l'intention d'utiliser les modules chargés + dynamiquement (ce qui est probablement le cas si vous êtes en train de + lire ce document afin de personnaliser votre serveur en recherchant le + moindre des gains en performances), vous pouvez ajouter la définition + <code>-DDYNAMIC_MODULE_LIMIT=0</code> à la construction de votre serveur. + Ceci aura pour effet de libérer la mémoire RAM allouée pour le + chargement dynamique des modules.</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">Appendice : Analyse détaillée d'une trace</a></h2> + + + + <p>Voici la trace d'un appel système d'Apache 2.0.38 avec le MPM worker + sous Solaris 8. Cette trace a été collectée à l'aide de la commande :</p> + + <div class="example"><p><code> + truss -l -p <var>httpd_child_pid</var>. + </code></p></div> + + <p>L'option <code>-l</code> demande à truss de tracer l'ID du LWP + (lightweight process--la version de Solaris des threads niveau noyau) qui + invoque chaque appel système.</p> + + <p>Les autres systèmes peuvent proposer des utilitaires de traçage + des appels système différents comme <code>strace</code>, + <code>ktrace</code>, ou <code>par</code>. Ils produisent cependant tous une + trace similaire.</p> + + <p>Dans cette trace, un client a demandé un fichier statique de 10 ko au + démon httpd. Le traçage des requêtes pour des contenus non statiques + ou comportant une négociation de contenu a une présentation + différente (et même assez laide dans certains cas).</p> + + <div class="example"><pre>/67: accept(3, 0x00200BEC, 0x00200C0C, 1) (sleeping...) +/67: accept(3, 0x00200BEC, 0x00200C0C, 1) = 9</pre></div> + + <p>Dans cette trace, le thread à l'écoute s'exécute à l'intérieur de + LWP #67.</p> + + <div class="note">Notez l'absence de la sérialisation d'<code>accept(2)</code>. Sur + cette plateforme spécifique, le MPM worker utilise un accept non sérialisé + par défaut sauf s'il est en écoute sur des ports multiples.</div> + + <div class="example"><pre>/65: lwp_park(0x00000000, 0) = 0 +/67: lwp_unpark(65, 1) = 0</pre></div> + + <p>Après avoir accepté la connexion, le thread à l'écoute réactive un + thread du worker pour effectuer le traitement de la requête. Dans cette + trace, le thread du worker qui traite la requête est associé à + LWP #65.</p> + + <div class="example"><pre>/65: getsockname(9, 0x00200BA4, 0x00200BC4, 1) = 0</pre></div> + + <p>Afin de pouvoir implémenter les hôtes virtuels, Apache doit connaître + l'adresse du socket local utilisé pour accepter la connexion. On pourrait + supprimer cet appel dans de nombreuses situations (par exemple dans le cas + où il n'y a pas d'hôte virtuel ou dans le cas où les directives + <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> contiennent des adresses + sans caractères de substitution). Mais aucun effort n'a été accompli à ce + jour pour effectuer ces optimisations.</p> + + <div class="example"><pre>/65: brk(0x002170E8) = 0 +/65: brk(0x002190E8) = 0</pre></div> + + <p>L'appel <code>brk(2)</code> alloue de la mémoire dans le tas. Ceci est + rarement visible dans une trace d'appel système, car le démon httpd + utilise des allocateurs mémoire de son cru (<code>apr_pool</code> et + <code>apr_bucket_alloc</code>) pour la plupart des traitements de requêtes. + Dans cette trace, le démon httpd vient juste de démarrer, et il doit + appeler <code>malloc(3)</code> pour réserver les blocs de mémoire + nécessaires à la création de ses propres allocateurs de mémoire.</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>Ensuite, le thread de worker passe la connexion du client (descripteur + de fichier 9) en mode non blocant. Les appels <code>setsockopt(2)</code> + et <code>getsockopt(2)</code> constituent un effet de bord de la manière + dont la libc de Solaris utilise <code>fcntl(2)</code> pour les sockets.</p> + + <div class="example"><pre>/65: read(9, " G E T / 1 0 k . h t m".., 8000) = 97</pre></div> + + <p>Le thread de worker lit la requête du client.</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>Ce démon httpd a été configuré avec les options + <code>Options FollowSymLinks</code> et <code>AllowOverride None</code>. Il + n'a donc ni besoin d'appeler <code>lstat(2)</code> pour chaque répertoire + du chemin du fichier demandé, ni besoin de vérifier la présence de fichiers + <code>.htaccess</code>. Il appelle simplement <code>stat(2)</code> pour + vérifier d'une part que le fichier existe, et d'autre part que c'est un + fichier régulier, et non un répertoire.</p> + + <div class="example"><pre>/65: sendfilev(0, 9, 0x00200F90, 2, 0xFAF7B53C) = 10269</pre></div> + + <p>Dans cet exemple, le démon httpd peut envoyer l'en-tête de la réponse + HTTP et le fichier demandé à l'aide d'un seul appel système + <code>sendfilev(2)</code>. La sémantique de sendfile varie en fonction des + systèmes d'exploitation. Sur certains autres systèmes, il faut faire un + appel à <code>write(2)</code> ou <code>writev(2)</code> pour envoyer les + en-têtes avant d'appeler <code>sendfile(2)</code>.</p> + + <div class="example"><pre>/65: write(4, " 1 2 7 . 0 . 0 . 1 - ".., 78) = 78</pre></div> + + <p>Cet appel à <code>write(2)</code> enregistre la requête dans le journal + des accès. Notez qu'une des choses manquant à cette trace est un appel à + <code>time(2)</code>. A la différence d'Apache 1.3, Apache 2.x utilise + <code>gettimeofday(3)</code> pour consulter l'heure. Sur certains systèmes + d'exploitation, comme Linux ou Solaris, <code>gettimeofday</code> est + implémenté de manière optimisée de telle sorte qu'il consomme moins de + ressources qu'un appel système habituel.</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>Le thread de worker effectue une fermeture "en prenant son temps" + (lingering close) de la connexion.</p> + + <div class="example"><pre>/65: close(10) = 0 +/65: lwp_park(0x00000000, 0) (sleeping...)</pre></div> + + <p>Enfin, le thread de worker ferme le fichier qu'il vient de délivrer et + se bloque jusqu'à ce que le thread en écoute lui assigne une autre + connexion.</p> + + <div class="example"><pre>/67: accept(3, 0x001FEB74, 0x001FEB94, 1) (sleeping...)</pre></div> + + <p>Pendant ce temps, le thread à l'écoute peut accepter une autre connexion + à partir du moment où il a assigné la connexion présente à un thread de + worker (selon une certaine logique de contrôle de flux dans le MPM worker + qui impose des limites au thread à l'écoute si tous les threads de worker + sont occupés). Bien que cela n'apparaisse pas dans cette trace, + l'<code>accept(2)</code> suivant peut (et le fait en général, en situation + de charge élevée) s'exécuter en parallèle avec le traitement de la + connexion qui vient d'être acceptée par le thread de worker.</p> + + </div></div> +<div class="bottomlang"> +<p><span>Langues Disponibles: </span><a href="../en/misc/perf-tuning.html" hreflang="en" rel="alternate" title="English"> en </a> | +<a href="../fr/misc/perf-tuning.html" title="Français"> fr </a> | +<a href="../ko/misc/perf-tuning.html" hreflang="ko" rel="alternate" 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">Commentaires</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 2019 The Apache Software Foundation.<br />Autorisé sous <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p> +<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossaire</a> | <a href="../sitemap.html">Plan du site</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- +if (typeof(prettyPrint) !== 'undefined') { + prettyPrint(); +} +//--><!]]></script> +</body></html>
\ No newline at end of file diff --git a/docs/manual/misc/perf-tuning.html.ko.euc-kr b/docs/manual/misc/perf-tuning.html.ko.euc-kr new file mode 100644 index 0000000..eb8c9e7 --- /dev/null +++ b/docs/manual/misc/perf-tuning.html.ko.euc-kr @@ -0,0 +1,1006 @@ +<?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.png" /></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"><a href="https://www.apache.org/foundation/contributing.html" class="badge"><img src="https://www.apache.org/images/SupportApache-small.png" alt="Support Apache!" /></a><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><h3>Âü°í</h3><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>Ä¿³ÎÀº ÀÚ½ÅÀÇ Ä³½¬¸¦ »ç¿ëÇÏ¿© 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 2019 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>
\ No newline at end of file diff --git a/docs/manual/misc/perf-tuning.html.tr.utf8 b/docs/manual/misc/perf-tuning.html.tr.utf8 new file mode 100644 index 0000000..addc1cf --- /dev/null +++ b/docs/manual/misc/perf-tuning.html.tr.utf8 @@ -0,0 +1,1021 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!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="tr" xml:lang="tr"><head> +<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> +<!-- + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + This file is generated from xml source: DO NOT EDIT + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + --> +<title>Apache’de Başarımın Arttırılması - Apache HTTP Sunucusu Sürüm 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/">Modüller</a> | <a href="../mod/directives.html">Yönergeler</a> | <a href="http://wiki.apache.org/httpd/FAQ">SSS</a> | <a href="../glossary.html">Terimler</a> | <a href="../sitemap.html">Site Haritası</a></p> +<p class="apache">Apache HTTP Sunucusu Sürüm 2.4</p> +<img alt="" src="../images/feather.png" /></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 Sunucusu</a> > <a href="http://httpd.apache.org/docs/">Belgeleme</a> > <a href="../">Sürüm 2.4</a> > <a href="./">Çeşitli Belgeler</a></div><div id="page-content"><div id="preamble"><h1>Apache’de Başarımın Arttırılması</h1> +<div class="toplang"> +<p><span>Mevcut Diller: </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" hreflang="ko" rel="alternate" title="Korean"> ko </a> | +<a href="../tr/misc/perf-tuning.html" title="Türkçe"> tr </a></p> +</div> + + + <p>Apache 2.x, esneklik, taşınabilirlik ve başarım arasında bir denge + sağlamak üzere tasarlanmış genel amaçlı bir HTTP sunucusudur. Başka + sunucularla kıyaslama denemelerinde öne geçmek üzere tasarlanmamış + olsa da Apache 2.x gerçek yaşamda karşılaşılan pek çok durumda oldukça + yüksek bir başarıma ulaşacak yetenektedir.</p> + + <p>Apache 1.3 ile karşılaştırıldığında 2.x sürümleri toplam veri hızını + ve ölçeklenebilirliği arttırmak için pek çok en iyileme seçeneği + içerir. Bu iyileştirmelerin pek çoğu zaten öntanımlı olarak etkin + olmakla birlikte derleme ve kullanım sırasında başarımı önemli ölçüde + etkileyebilen yapılandırma seçenekleri de mevcuttur. Bu belgede, bir + Apache 2.x kurulumunda sunucu yöneticisinin sunucunun başarımını + arttırmak amacıyla yapılandırma sırasında neler yapabileceğinden + bahsedilmiştir. Bu yapılandırma seçeneklerinden bazıları, httpd’nin + donanımın ve işletim sisteminin olanaklarından daha iyi + yararlanabilmesini sağlarken bir kısmı da daha hızlı bir sunum için + yöneticinin işlevsellikten ödün verebilmesini olanaklı kılar.</p> + + </div> +<div id="quickview"><a href="https://www.apache.org/foundation/contributing.html" class="badge"><img src="https://www.apache.org/images/SupportApache-small.png" alt="Support Apache!" /></a><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#hardware">Donanım ve İşletim Sistemi ile İlgili Konular</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#runtime">Çalışma Anı Yapılandırması ile İlgili Konular</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#compiletime">Derleme Sırasında Yapılandırma ile İlgili Konular</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#trace">Ek: Bir çağrı izlemesinin ayrıntılı çözümlemesi</a></li> +</ul><h3>Ayrıca bakınız:</h3><ul class="seealso"><li><a href="#comments_section">Yorum</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">Donanım ve İşletim Sistemi ile İlgili Konular</a></h2> + + + + <p>HTTP sunucusunun başarımını etkileyen en önemli donanım bellektir + (RAM). Bir HTTP sunucusu asla takaslama yapmamalıdır. Çünkü takaslama, + kullanıcının "yeterince hız" umduğu noktada sunumun gecikmesine sebep + olur. Böyle bir durumda kullanıcılar yüklemeyi durdurup tekrar + başlatma eğilimindedirler; sonuçta yük daha da artar. <code class="directive"><a href="../mod/mpm_common.html#maxrequestworkers">MaxRequestWorkers</a></code> yönergesinin değerini + değiştirerek takaslamaya sebep olabilecek kadar çok çocuk süreç + oluşturulmasını engelleyebilirsiniz ve böyle bir durumda bunu mutlaka + yapmalısınız. Bunun için yapacağınız işlem basittir: <code>top</code> + benzeri bir araç üzerinden çalışan süreçlerinizin bir listesini alıp + Apache süreçlerinizin ortalama büyüklüğünü saptayıp, mevcut bellekten + bir kısmını diğer süreçler için ayırdıktan sonra kalan miktarı bu + değere bölerseniz yönergeye atayacağınız değeri bulmuş olursunuz.</p> + + <p>Donanımın diğer unsurları için kararı siz verin: Daha hızlı işlemci, + daha hızlı ağ kartı, daha hızlı disk; daha hızlının ne kadar hızlı + olacağını deneyimlerinize bağlı olarak tamamen sizin ihtiyaçlarınız + belirler.</p> + + <p>İşletim sistemi seçimi büyük oranda yerel ilgi konusudur. Fakat yine + de, genelde yararlılığı kanıtlanmış bazı kurallar bu seçimde size + yardımcı olabilir:</p> + + <ul> + <li> + <p>Seçtiğiniz işletim sisteminin (çekirdeğin) en son kararlı + sürümünü çalıştırın. Bir çok işletim sistemi, son yıllarda TCP + yığıtları ve evre kütüphaneleri ile ilgili belirgin iyileştirmeler + yapmışlar ve yapmaktadırlar.</p> + </li> + + <li> + <p>İşletim sisteminiz <code>sendfile</code>(2) sistem çağrısını + destekliyorsa bunun etkinleştirilebildiği sürümün kurulu olması + önemlidir. (Örneğin, Linux için bu, Linux 2.4 ve sonraki sürümler + anlamına gelirken, Solaris için Solaris 8’den önceki sürümlerin + yamanması gerektirdiği anlamına gelmektedir.) + <code>sendfile</code> işlevinin desteklendiği sistemlerde Apache 2 + duruk içeriği daha hızlı teslim etmek ve işlemci kullanımını + düşürmek amacıyla bu işlevselliği kullanacaktır.</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">Çalışma Anı Yapılandırması ile İlgili Konular</a></h2> + + + + <table class="related"><tr><th>İlgili Modüller</th><th>İlgili Yönergeler</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"><code>HostnameLookups</code> ve DNS ile ilgili diğer konular</a></h3> + + + + <p>Apache 1.3 öncesinde, <code class="directive"><a href="../mod/core.html#hostnamelookups">HostnameLookups</a></code> yönergesinin öntanımlı değeri + <code>On</code> idi. İstek yerine getirilmeden önce bir DNS sorgusu + yapılmasını gerektirmesi sebebiyle bu ayarlama her istekte bir + miktar gecikmeye sebep olurdu. Apache 1.3’ten itibaren yönergenin + öntanımlı değeri <code>Off</code> yapılmıştır. Eğer günlük + dosyalarınızda konak isimlerinin bulunmasını isterseniz, Apache ile + birlikte gelen <code class="program"><a href="../programs/logresolve.html">logresolve</a></code> programını + kullanabileceğiniz gibi günlük raporlarını çözümleyen Apache ile + gelmeyen programlardan herhangi birini de kullanabilirsiniz.</p> + + <p>Günlük dosyaları üzerindeki bu işlemi sunucu makinesi dışında + günlük dosyasının bir kopyası üzerinde yapmanızı öneririz. Aksi + takdirde sunucunuzun başarımı önemli ölçüde etkilenebilir.</p> + + <p><code class="directive"><a href="../mod/mod_access_compat.html#allow">Allow</a></code> veya + <code class="directive"><a href="../mod/mod_access_compat.html#deny">Deny</a></code> + yönergelerinde IP adresi yerine bir konak veya alan ismi + belirtirseniz, iki DNS sorguluk bir bedel ödersiniz (biri normal, + diğeri IP taklidine karşı ters DNS sorgusu). Başarımı en iyilemek + için bu yönergelerde mümkün olduğunca isim yerine IP adreslerini + kullanınız.</p> + + <p><code class="directive"><a href="../mod/core.html#hostnamelookups">HostnameLookups</a></code> + yönergelerinin <code><Location "/server-status"></code> gibi + bölüm yönergelerinin içinde de yer alabileceğini unutmayın. Bu gibi + durumlarda DNS sorguları sadece istek kuralla eşleştiği takdirde + yapılacaktır. Aşağıdaki örnekte <code>.html</code> ve + <code>.cgi</code> dosyalarına yapılan istekler hariç DNS sorguları + iptal edilmektedir:</p> + + <pre class="prettyprint lang-config">HostnameLookups off +<Files ~ "\.(html|cgi)$"> + HostnameLookups on +</Files></pre> + + + <p>Yine de bazı CGI’lerin DNS isimlerine ihtiyacı olursa bu CGI’lerin + bu ihtiyaçlarına yönelik olarak <code>gethostbyname</code> çağrıları + yapabileceğini gözardı etmeyiniz.</p> + + + + <h3><a name="symlinks" id="symlinks"><code>FollowSymLinks</code> ve + <code>SymLinksIfOwnerMatch</code></a></h3> + + + + <p>URL uzayınızda geçerli olmak üzere bir <code>Options + FollowSymLinks</code> yoksa veya <code>Options + SymLinksIfOwnerMatch</code> yönergeleri varsa, Apache her sembolik + bağın üzerinde bazı sınamalar yapmak için ek bir sistem çağrısından + başka istenen her dosya için de ayrı bir çağrı yapacaktır.</p> + + <pre class="prettyprint lang-config">DocumentRoot "/siteler/htdocs" +<Directory /> + Options SymLinksIfOwnerMatch +</Directory></pre> + + + <p>Bu durumda <code>/index.html</code> için bir istek yapıldığında + Apache, <code>/siteler</code>, <code>/siteler/htdocs</code> ve<br /> + <code>/siteler/htdocs/index.html</code> üzerinde + <code>lstat</code>(2) çağrıları yapacaktır. <code>lstat</code> + sonuçları önbelleğe kaydedilmediğinden bu işlem her istekte + yinelenecektir. Amacınız gerçekten sembolik bağları güvenlik + açısından sınamaksa bunu şöyle yapabilirsiniz:</p> + + <pre class="prettyprint lang-config">DocumentRoot "/siteler/htdocs" +<Directory "/"> + Options FollowSymLinks +</Directory> + +<Directory "/siteler/htdocs"> + Options -FollowSymLinks +SymLinksIfOwnerMatch +</Directory></pre> + + + <p>Böylece <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> altındaki + dosyalar için fazladan bir çağrı yapılmasını engellemiş olursunuz. + Eğer bazı bölümlerde <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> gibi yönergeler üzerinden belge kök + dizininizin dışında kalan dosya yollarına sahipseniz benzer + işlemleri onlar için de yapmalısınız. Sembolik bağ koruması yapmamak + suretiyle başarımı arttırmak isterseniz, <code>FollowSymLinks</code> + seçeneğini her yerde etkin kılın ve + <code>SymLinksIfOwnerMatch</code> seçeneğini asla + etkinleştirmeyin.</p> + + + + <h3><a name="htaccess" id="htaccess"><code>AllowOverride</code></a></h3> + + + + <p>Genellikle <code>.htaccess</code> dosyaları üzerinden yapıldığı + gibi URL uzayınızda geçersizleştirmelere izin veriyorsanız, Apache + her dosya bileşeni için bu <code>.htaccess</code> dosyalarını açmaya + çalışacaktır.</p> + + <pre class="prettyprint lang-config">DocumentRoot "/siteler/htdocs" +<Directory "/"> + AllowOverride all +</Directory></pre> + + + <p>Bu durumda <code>/index.html</code> sayfasına yapılan bir istek için + Apache, <code>/.htaccess</code>, <code>/siteler/.htaccess</code> ve + <code>/siteler/htdocs/.htaccess</code> dosyalarını açmaya + çalışacaktır. Çözüm <code>Options FollowSymLinks</code> durumunun + benzeridir; başarımı arttırmak için dosya sisteminizin her yerinde + <code>AllowOverride None</code> olsun.</p> + + + + <h3><a name="negotiation" id="negotiation">Dil Uzlaşımı</a></h3> + + + + <p>Başarımı son kırıntısına kadar arttırmak istiyorsanız, mümkünse + içerik dili uzlaşımı da yapmayın. Dil uzlaşımından yararlanmak + isterken büyük başarım kayıplarına uğrayabilirsiniz. Böyle bir + durumda sunucunun başarımını arttırmanın tek bir yolu vardır. </p> + + <pre class="prettyprint lang-config">DirectoryIndex index</pre> + + + <p>Yukarıdaki gibi bir dosya ismi kalıbı kullanmak yerine, aşağıdaki + gibi seçenekleri tam bir liste halinde belirtin:</p> + + <pre class="prettyprint lang-config">DirectoryIndex index.cgi index.pl index.shtml index.html</pre> + + + <p>Buradaki sıralama öncelik sırasını belirler; yani, + öncelikli olmasını istediğiniz seçeneği listenin başına + yazmalısınız.</p> + + <p>İstenen dosya için <code>MultiViews</code> kullanarak dizini + taratmak yerine, gerekli bilgiyi tek bir dosyadan okutmak suretiyle + başarımı arttırabilirsiniz. Bu amaçla türeşlem + (<code>type-map</code>) dosyaları kullanmanız yeterli olacaktır.</p> + + <p>Sitenizde içerik dili uzlaşımına gerek varsa, bunu <code>Options + MultiViews</code> yönergesi üzerinden değil, türeşlem dosyaları + kullanarak yapmayı deneyin. İçerik dili uzlaşımı ve türeşlem + dosyalarının oluşturulması hakkında daha ayrıntılı bilgi edinmek + için <a href="../content-negotiation.html">İçerik Uzlaşımı</a> + belgesine bakınız.</p> + + + + <h3>Bellek Eşlemleri</h3> + + + + <p>Apache’nin SSI sayfalarında olduğu gibi teslim edilecek dosyanın + içeriğine bakma gereği duyduğu durumlarda, eğer işletim sistemi + <code>mmap</code>(2) ve benzerlerini destekliyorsa çekirdek normal + olarak dosyayı belleğe kopyalayacaktır.</p> + + <p>Bazı platformlarda bu belleğe eşleme işlemi başarımı arttırsa da + başarımın veya httpd kararlılığının zora girdiği durumlar + olabilmektedir:</p> + + <ul> + <li> + <p>Bazı işletim sistemlerinde işlemci sayısı artışına bağlı + olarak, <code>mmap</code> işlevi <code>read</code>(2) kadar iyi + ölçeklenmemiştir. Örneğin, çok işlemcili Solaris sunucularda + <code>mmap</code> iptal edildiği takdirde içeriği sunucu + tarafından işlenen dosyalar üzerinde bazen daha hızlı işlem + yapılabilmektedir.</p> + </li> + + <li> + <p>Belleğe kopyalanacak dosya NFS üzerinden bağlanan bir dosya + sistemindeyse ve dosya başka bir NFS istemcisi makine tarafından + silinmiş veya dosyanın boyutu değiştirilmişse sunucunuz dosyaya + tekrar erişmeye çalıştığında bir hata alabilecektir.</p> + </li> + </ul> + + <p>Böyle durumların olasılık dahilinde olduğu kurulumlarda içeriği + sunucu tarafından işlenecek dosyaların belleğe kopyalanmaması için + yapılandırmanıza <code>EnableMMAP off</code> satırını ekleyiniz. + (Dikkat: Bu yönerge dizin seviyesinde geçersizleştirilebilen + yönergelerdendir.)</p> + + + + <h3><code>sendfile</code></h3> + + + + <p>Apache’nin duruk dosyalarda olduğu gibi teslim edilecek dosyanın + içeriğine bakmadığı durumlarda, eğer işletim sistemi + <code>sendfile</code>(2) desteğine sahipse çekirdek normal olarak bu + desteği kullanacaktır.</p> + + <p>Bazı platformlarda <code>sendfile</code> kullanımı, okuma ve yazma + işlemlerinin ayrı ayrı yapılmamasını sağlasa da + <code>sendfile</code> kullanımının httpd kararlılığını bozduğu bazı + durumlar sözkonusudur:</p> + + <ul> + <li> + <p>Bazı platformlar derleme sisteminin saptayamadığı bozuk bir + <code>sendfile</code> desteğine sahip olabilir. Özellikle + derleme işleminin başka bir platformda yapılıp + <code>sendfile</code> desteği bozuk bir makineye kurulum + yapıldığı durumlarda bu desteğin bozuk olduğu + saptanamayacaktır.</p> + </li> + <li> + <p>Çekirdek, NFS üzerinden erişilen ağ dosyalarını kendi önbelleği + üzerinden gerektiği gibi sunamayabilir.</p> + </li> + </ul> + + <p>Böyle durumların olasılık dahilinde olduğu kurulumlarda içeriğin + <code>sendfile</code> desteğiyle teslim edilmemesi için + yapılandırmanıza <code>EnableSendfile off</code> satırını ekleyiniz. + (Dikkat: Bu yönerge dizin seviyesinde geçersizleştirilebilen + yönergelerdendir.)</p> + + + + <h3><a name="process" id="process">Süreç Oluşturma</a></h3> + + + + <p>Apache 1.3 öncesinde <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>, <code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code> ve <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code> ayarları, başka sunucularla kıyaslama + denemelerinde olağanüstü kötü sonuçlar alınmasına sebep olmaktaydı. + Özellikle uygulanan yükü karşılamaya yetecek sayıda çocuk süreç + oluşturulması aşamasında Apache’nin elde ettiği ivme bunlardan + biriydi. Başlangıçta <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code> yönergesiyle belli sayıda süreç + oluşturulduktan sonra her saniyede bir tane olmak üzere <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code> sayıda çocuk süreç + oluşturulmaktaydı. Örneğin, aynı anda 100 isteğe yanıt vermek için + <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code> + yönergesinin öntanımlı değeri olarak başta <code>5</code> süreç + oluşturulduğundan kalan süreçler için 95 saniye geçmesi gerekirdi. + Sık sık yeniden başlatılmadıklarından dolayı gerçek hayatta + sunucuların başına gelen de buydu. Başka sunucularla kıyaslama + denemelerinde ise işlem sadece on dakika sürmekte ve içler acısı + sonuçlar alınmaktaydı.</p> + + <p>Saniyede bir kuralı, sunucunun yeni çocukları oluşturması sırasında + sistemin aşırı meşgul duruma düşmemesi için alınmış bir önlemdi. + Makine çocuk süreç oluşturmakla meşgul edildiği sürece isteklere + yanıt veremeyecektir. Böylesi bir durum Apache’nin başarımını + kötüleştirmekten başka işe yaramayacaktır. Apache 1.3’te saniyede + bir kuralı biraz esnetildi. Yeni gerçeklenimde artık bir süreç + oluşturduktan bir saniye sonra iki süreç, bir saniye sonra dört + süreç oluşturulmakta ve işlem, saniyede 32 çocuk süreç oluşturulur + duruma gelene kadar böyle ivmelenmektedir. Çocuk süreç oluşturma + işlemi <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code> + değerine ulaşılınca durmaktadır.</p> + + <p>Bu, <code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>, + <code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code> ve + <code class="directive"><a href="../mod/mpm_common.html#startservers">StartServers</a></code> ayarlarıyla + oynamayı neredeyse gereksiz kılacak kadar iyi sonuçlar verecek gibi + görünmektedir. Saniyede 4 çocuktan fazlası oluşturulmaya + başlandığında hata günlüğüne bazı iletiler düşmeye başlar. Bu + iletilerin sayısı çok artarsa bu ayarlarla oynama vakti gelmiş + demektir. Bunun için <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> çıktısını bir + kılavuz olarak kullanabilirsiniz.</p> + + <p>Süreç oluşturmayla ilgili olarak süreç ölümü <code class="directive"><a href="../mod/mpm_common.html#maxconnectionsperchild">MaxConnectionsPerChild</a></code> değeri ile + sağlanır. Bu değer öntanımlı olarak <code>0</code> olup, çocuk süreç + başına istek sayısının sınırsız olduğu anlamına gelir. Eğer + yapılandırmanızda bu değeri <code>30</code> gibi çok düşük bir + değere ayarlarsanız bunu hemen kaldırmak zorunda kalabilirsiniz. + Sunucunuzu SunOS veya Solaris’in eski bir sürümü üzerinde + çalıştırıyorsanız bellek kaçaklarına sebep olmamak için bu değeri + <code>10000</code> ile sınırlayınız.</p> + + <p>Kalıcı bağlantı özelliğini kullanıyorsanız, çocuk süreçler zaten + açık bağlantılardan istek beklemekte olacaklardır. <code class="directive"><a href="../mod/core.html#keepalivetimeout">KeepAliveTimeout</a></code> yönergesinin öntanımlı + değeri <code>5</code> saniye olup bu etkiyi en aza indirmeye yönelik + süredir. Burada ağ band genişliği ile sunucu kaynaklarının kullanımı + arasında bir seçim yapmak söz konusudur. Hiçbir şey umurunuzda + değilse <a href="http://www.hpl.hp.com/techreports/Compaq-DEC/WRL-95-4.html"> + çoğu ayrıcalığın yitirilmesi pahasına</a> bu değeri rahatça + <code>60</code> saniyenin üzerine çıkarabilirsiniz.</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">Derleme Sırasında Yapılandırma ile İlgili Konular</a></h2> + + + <h3>MPM Seçimi</h3> + + + <p>Apache 2.x, <a href="../mpm.html">Çok Süreçlilik Modülleri</a> + (MPM) adı verilen eklemlenebilir çok görevlilik modellerini + destekler. Apache’yi derlerken bu MPM’lerden birini seçmeniz + gerekir. MPM’lerden bazıları platformlara özeldir: + <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> ve + <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>. Unix + benzeri sistemler için ise seçebileceğiniz modül sayısı birden + fazladır. MPM seçiminin httpd’nin hızında ve ölçeklenebilirliğinde + bazı etkileri olabilir:</p> + + <ul> + + <li><code class="module"><a href="../mod/worker.html">worker</a></code> modülü her biri çok evreli çok sayıda + çocuk süreç kullanımını destekler. Her evre aynı anda tek bir + bağlantıya hizmet sunar. Aynı hizmeti daha az bellek harcayarak + vermesi nedeniyle yüksek trafiğe sahip sunucularda + <code class="module"><a href="../mod/prefork.html">prefork</a></code> modülüne göre daha iyi bir seçimdir.</li> + + <li><code class="module"><a href="../mod/event.html">event</a></code> modülü <code class="module"><a href="../mod/worker.html">worker</a></code> modülü gibi + çok evreli bir modüldür, fakat aunı anda dahafazla isteğe yanıt + verecek şekilde tasarlanmıştır. Bunu, evreleri destekleyen bazı + işlemleri yapmamak suretiyle yeni isteklerle çalışacak ana evreleri + serbestleştirerek sağlar.</li> + + <li><code class="module"><a href="../mod/prefork.html">prefork</a></code> modülü her biri tek bir evreye sahip + çok sayıda çocuk süreç kullanımını destekler. Her süreç aynı anda + tek bir bağlantıya hizmet sunar. Çoğu sistemde daha hızlı olması + nedeniyle <code class="module"><a href="../mod/worker.html">worker</a></code> modülüne göre daha iyi bir seçim + olarak görünürse de bunu daha fazla bellek kullanarak sağlar. + <code class="module"><a href="../mod/prefork.html">prefork</a></code> modülünün evresiz tasarımının + <code class="module"><a href="../mod/worker.html">worker</a></code> modülüne göre bazı yararlı tarafları + vardır: Çok evreli sistemlerde güvenilir olmayan üçüncü parti + modülleri kullanabilir ve evrelerde hata ayıklamanın yetersiz + kaldığı platformlarda hatalarını ayıklamak daha kolaydır.</li> + + </ul> + + <p>Bu modüller ve diğerleri hakkında daha ayrıntılı bilgi edinmek için + <a href="../mpm.html">Çok Süreçlilik Modülleri</a> belgesine + bakınız.</p> + + + + <h3><a name="modules" id="modules">Modüller</a></h3> + + + + <p>Bellek kullanımı başarım konusunda önemli olduğundan gerçekte + kullanmadığınız modülleri elemeye çalışmalısınız. Modülleri birer <a href="../dso.html">DSO</a> olarak derlediyseniz <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code> yönergesinin bulunduğu satırı + açıklama haline getirmeniz modülden kurtulmanız için yeterli + olacaktır. Modülleri bu şekilde kaldırarak onların yokluğunda + sitenizin hala işlevlerini yerine getirdiğini görme şansına da + kavuşmuş olursunuz.</p> + + <p>Ancak, eğer modülleri Apache çalıştırılabilirinin içine + gömmüşseniz istenmeyen modülleri kaldırmak için Apache'yi yeniden + derlemeniz gerekir.</p> + + <p>Bu noktada bir soru akla gelebilir: Hangi modüller gerekli, + hangileri değil? Bu sorunun yanıtı şüphesiz siteden siteye değişir. + Ancak, olmazsa olmaz moüller olarak <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> ve <code class="module"><a href="../mod/mod_log_config.html">mod_log_config</a></code> + modüllerini sayabiliriz. Bunlardan <code>mod_log_config</code> + olmadan da bir sitenin çalışabileceğinden hareketle bu modülün + varlığı isteğe bağlı olsa da bu modülü kaldırmanızı önermiyoruz.</p> + + + + <h3>Atomik İşlemler</h3> + + + + <p>Worker MPM'nin en son geliştirme sürümleri ve + <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code> gibi bazı modüller APR'nin atomik API'sini + kullanırlar. Bu API, düşük ayarlı evre eşzamanlamasında atomik + işlemler yapar.</p> + + <p>Öntanımlı olarak, APR bu işlemleri hedef işletim sistemi/işlemci + platformunda kullanılabilecek en verimli mekanizmayı kullanarak + gerçekleştirir. Günümüz işlemcilerinin çoğu, örneğin, bir atomik + karşılaştırma ve takas (CAS) işlemini donanımda gerçekleştirmektedir. + Bazı platformlarda APR'nin atomik işlemler için öntanımlı olarak daha + yavaş olan mutekslere dayalı gerçeklenimi kullanmasının sebebi eski + işlemcilerde bu tür makine kodlarının yokluğudur. Apache'yi bu tür + platformalarda günümüz işlemcileriyde çalıştırmayı düşünüyorsanız + Apache'yi derlemek için yapılandırırken en hızlı atomik işlemin + seçilebilmesi için <code>--enable-nonportable-atomics</code> + seçeneğini kullanın:</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> seçeneği şu platformlar + için uygundur:</p> + + <ul> + + <li>SPARC üzerinde Solaris<br /> + APR öntanımlı olarak, SPARC/Solaris üzerinde mutekslere dayalı + atomik işlemleri kullanır. Ancak, + <code>--enable-nonportable-atomics</code> yapılandırmasını + kullanırsanız, donanım üzerinde hızlı karşılaştırma ve takas + için uygun SPARC v8plus kodunu kullanacak şekilde kod üretilir. + Apache'yi bu seçenekle yapılandırırsanız atomik işlemler daha + verimli olacak fakat derlenen Apache çalıştırılabiliri sadece + UltraSPARC kırmığı üzerinde çalışacaktır. + </li> + + <li>x86 üzerinde Linux<br /> + APR öntanımlı olarak, Linux üzerinde mutekslere dayalı atomik + işlemleri kullanır. Ancak, + <code>--enable-nonportable-atomics</code> yapılandırmasını + kullanırsanız, donanım üzerinde hızlı karşılaştırma ve takas + için uygun 486 kodunu kullanacak şekilde kod üretilir. Apache'yi + bu seçenekle yapılandırırsanız atomik işlemler daha verimli + olacak fakat derlenen Apache çalıştırılabiliri (386 üzerinde + değil) sadece 486 ve sonrası kırmıklarda çalışacaktır. + </li> + + </ul> + + + + <h3><code>mod_status</code> ve <code>ExtendedStatus On</code> + </h3> + + + + <p><code class="module"><a href="../mod/mod_status.html">mod_status</a></code> modülünü derlemiş ve Apache'yi + yapılandırır ve çalıştırırken <code>ExtendedStatus On</code> satırını + da kullanmışsanız Apache her istek üzerinde + <code>gettimeofday(2)</code> (veya işletim sistemine bağlı olarak + <code>time(2)</code>) çağrısından başka (1.3 öncesinde) fazladan + defalarca <code>time(2)</code> çağrıları yapacaktır. Bu çağrılarla + durum raporununun zamanlama bilgilerini içermesi sağlanır. Başarımı + arttırmak için <code>ExtendedStatus off</code> yapın (zaten öntanımlı + böyledir).</p> + + + + <h3><code>accept</code> dizgilemesi ve çok soketli işlem</h3> + + + + <div class="warning"><h3>Uyarı:</h3> + <p>Bu bölüm, Apache HTTP sunucusunun 2.x sürümlerinde yapılan + değişikliklere göre tamamen güncellenmemiştir. Bazı bilgiler hala + geçerliyse de lütfen dikkatli kullanınız.</p> + </div> + + <p>Burada Unix soket arayüzü gerçeklenirken ihmal edilen bir durumdan + bahsedeceğiz. HTTP sunucunuzun çok sayıda adresten çok sayıda portu + dinlemek için çok sayıda <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> yönergesi kullanmakta olduğunu varsayalım. Her + soketi çalıştığını görmek için denerken Apache bağlantı için + <code>select(2)</code> kullanacaktır. <code>select(2)</code> çağrısı + bu soketin üzerinde <em>sıfır</em> veya <em>en azından bir</em> + bağlantının beklemekte olduğu anlamına gelir. Apache'nin modeli çok + sayıda çocuk süreç içerir ve boşta olanların tümünde aynı anda yeni + bağlantılar denenebilir. Gerçekte çalışan kod bu olmasa da meramımızı + anlatmak için kodun şöyle bir şey olduğunu varsayabiliriz:</p> + + <pre class="prettyprint lang-c"> for (;;) { + for (;;) { + fd_set accept_fds; + + FD_ZERO (&accept_fds); + for (i = first_socket; i <= last_socket; ++i) { + FD_SET (i, &accept_fds); + } + rc = select (last_socket+1, &accept_fds, NULL, NULL, NULL); + if (rc < 1) continue; + new_connection = -1; + for (i = first_socket; i <= last_socket; ++i) { + if (FD_ISSET (i, &accept_fds)) { + new_connection = accept (i, NULL, NULL); + if (new_connection != -1) break; + } + } + if (new_connection != -1) break; + } + process_the(new_connection); + }</pre> + + + <p>Bu özet gerçeklenim bir takım açlık sorunlarına sebep olur. Bu + döngünün çalışması sırasında aynı anda çok sayıda çocuk süreç yeniden + çağrılır ve istekler arasında kalan çoğu çocuk da <code>select</code> + ile engellenir. Engellenen tüm bu çocuklar soketlerden herhangi biri + üzerinde tek bir istek göründüğünde <code>select</code> tarafından + uyandırılıp işleme sokulmak üzere döndürülürler. (Uyandırılan çocuk + sayısı işletim sistemine ve zamanlama ayarlarına göre değişiklik + gösterir,) Bunların hepsi döngüye katılıp bağlantı kabul etmeye + (<code>accept</code>) çalışırlar. Fakat içlerinden yalnız biri + (sadece bir bağlantı isteğinin mevcut olduğu varsayımıyla) bunu + başarabilir. Kalanının bağlantı kabul etmesi (<code>accept</code>) + <em>engellenir</em>. Bu durum, bu çocukları istekleri başka başka soketlerden + değil mecburen tek bir soketten kabul etmeye kilitler ve bu soket + üzerinde yeni bir istek belirip uyandırılana kadar bu durumda + kalırlar. Bu açlık sorunu ilk olarak <a href="http://bugs.apache.org/index/full/467">PR#467</a> sayılı raporla + belgelenmiştir. Bu sorunun en az iki çözümü vardır.</p> + + <p>Çözümün biri engellenmeyen soket kullanımıdır. Bu durumda + <code>accept</code> çocukları engellemeyecek ve yapılan bir + bağlantının ardından diğer çocuklar durumları değişmeksizin bağlantı + beklemeye devam edeceklerdir. Fakat bu durum işlemci zamanının boşa + harcanmasına sebep olur. Seçilmiş (<code>select</code>) boşta on + çocuğun olduğunu ve bir bağlantı geldiğini varsayalım. Kalan dokuz + çocuk işine devam edip bağlantı kabul etmeyi (<code>accept</code>) + deneyecek, başarızsız olacak, dönecek başa, tekrar seçilecek + (<code>select</code>) ve böyle hiçbir iş yapmadan dönüp duracaktır. Bu + arada hizmet sunmakta olanlar da işlerini bitirdikten sonra bu + döngüdeki yerlerini alacaklardır. Aynı kutunun içinde boşta bir sürü + işlemciniz (çok işlemcili sistemler) yoksa bu çözüm pek verimli + olmayacaktır.</p> + + <p>Diğer çözüm ise Apache tarafından kullanılan çözüm olup, girdiyi + bir iç döngüde sıraya sokmaktır. Döngü aşağıda örneklenmiştir (farklar + vurgulanmıştır):</p> + + <pre class="prettyprint lang-c"> for (;;) { + <strong>accept_mutex_on ();</strong> + for (;;) { + fd_set accept_fds; + + FD_ZERO (&accept_fds); + for (i = first_socket; i <= last_socket; ++i) { + FD_SET (i, &accept_fds); + } + rc = select (last_socket+1, &accept_fds, NULL, NULL, NULL); + if (rc < 1) continue; + new_connection = -1; + for (i = first_socket; i <= last_socket; ++i) { + if (FD_ISSET (i, &accept_fds)) { + new_connection = accept (i, NULL, NULL); + if (new_connection != -1) break; + } + } + if (new_connection != -1) break; + } + <strong>accept_mutex_off ();</strong> + process the new_connection; + }</pre> + + + <p><code>accept_mutex_on</code> ve <code>accept_mutex_off</code> <a id="serialize" name="serialize">işlevleri</a> bir karşılıklı red + semoforu oluştururlar. Mutekse aynı anda sadece bir çocuk sahip + olabilir. Bu muteksleri gerçeklemek için çeşitli seçenekler vardır. + Seçim, <code>src/conf.h</code> (1.3 öncesi) veya + <code>src/include/ap_config.h</code> (1.3 ve sonrası) dosyasında + tanımlanmıştır. Bazı mimariler bir kilitleme seçeneğine sahip + değildir. Böyle mimarilerde çok sayıda <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> yönergesi kullanmak güvenilir + olmayacaktır.</p> + + <p><code class="directive"><a href="../mod/core.html#mutex">Mutex</a></code> yönergesi, + <code>mpm-accept</code> muteks gerçeklenimini çalışma anında değiştirmek + için kullanılabilir. Farklı muteks gerçeklenimleri ile ilgili hususlar + bu yönergede belgelenmiştir.</p> + + <p>Başka bir çözüm daha vardır ancak döngü kısmen dizgilenmeyeceğinden + (yani belli sayıda sürece izin verilemeyeceğinden) asla + gerçeklenmemiştir. Bu sadece, aynı anda çok sayıda çocuk sürecin + çalışabileceği ve dolayısıyla band genişliğinin tüm yönleriyle + kullanılabileceği çok işlemcili sistemlerde ilginç olabilirdi. Bu + gelecekte incelenmeye değer bir konu olmakla beraber çok sayıda HTTP + sunucusunun aynı anda aynı amaca hizmet edecek şekilde çalışması + standart olarak pek mümkün görülmediğinden bu olasılık çok + düşüktür.</p> + + <p>En yüksek başarımı elde etmek için ideal olanı sunucuları + çalıştırırken çok sayıda <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> yönergesi kullanmamaktır. Fakat siz yine de + okumaya devam edin.</p> + + + + <h3><code>accept</code> dizgilemesi - tek soket</h3> + + + + <p>Çok soketli sunucular için yukarıda açıklananlar iyi güzel de tek + soketli sunucularda durum ne? Kuramsal olarak, bunların hiçbiriyle bir + sorunları olmaması gerekir. Çünkü yeni bir bağlantı gelene kadar tüm + çocuklar <code>accept(2)</code> ile engellenirler dolayısıyla hiçbir + açlık sorununun ortaya çıkmaması gerekir. Uygulamada ise son + kullanıcıdan gizli olarak, yukarıda engellenmeyen çocuklar çözümünde + bahsedilenle hemen hemen aynı "boşa dönüp durma" davranışı mevcuttur. + Çoğu TCP yığıtı bu yolu gerçeklemiştir. Çekirdek, yeni bir bağlantı + ortaya çıktığında <code>accept</code> ile engellenen tüm süreçleri + uyandırır. Bu süreçlerden bağlantıyı alan kullanıcı bölgesine geçerken + çekirdek içinde döngüde olan diğerleri de yeni bağlantı keşfedilene + kadar uykularına geri dönerler. Bu çekirdek içi döngü, kullanıcı + bölgesindeki kodlara görünür değildir ama bu olmadıkları anlamına + gelmez. Bu durum, çok soketli engellenmeyen çocuklar çözümündeki boşa + döngünün sebep olduğu gereksiz işlemci yükü sorununu içinde + barındırır.</p> + + <p>Bununla birlikte, tek soketli durumda bile bundan daha verimli bir + davranış sergileyen bir çok mimari bulduk. Bu aslında hemen hemen her + durumda öntanımlı olarak böyledir. Linux altında yapılan üstünkörü + denemelerde (128MB bellekli çift Pentium pro 166 işlemcili makinede + Linux 2.0.30) tek sokette dizgilemenin dizgilenmemiş duruma göre + saniyede %3 daha az istekle sonuçlandığı gösterilmiştir. Fakat + dizgilenmemiş tek soket durumunda her istekte 100ms'lik ek bir gecikme + olduğu görülmüştür. Bu gecikmenin sebebi muhtemelen uzun mesafeli + hatlar olup sadece yerel ağlarda söz konusudur. Tek soketli + dizgilemeyi geçersiz kılmak için + <code>SINGLE_LISTEN_UNSERIALIZED_ACCEPT</code> tanımlarsanız tek + soketli sunucularda artık dizgileme yapılmayacaktır.</p> + + + + <h3>Kapatmayı zamana yaymak</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> taslağının 8. bölümünde + bahsedildiği gibi, bir HTTP sunucusunun protokolü <strong>güvenilir + şekilde</strong> gerçeklemesi için her iki yöndeki iletişimi + birbirinden bağımsız olarak (iki yönlü bir TCP bağlantısının her + yarısını diğerinden bağımsız olarak) kapatması gerekir.</p> + + <p>Bu özellik Apache'ye eklendiğinde Unix'in çeşitli sürümlerinde + uzgörüsüzlükten dolayı bir takım geçici telaş sorunlarına sebep oldu. + TCP belirtimi <code>FIN_WAIT_2</code> durumunda bir zaman aşımından + bahsetmez ama yasaklamaz da. Zaman aşımı olmayan sistemlerde, Apache + 1.2 çoğu soketin sonsuza kadar <code>FIN_WAIT_2</code> durumunda + takılıp kalmasına sebep olur. Çoğu durumda, satıcıdan sağlanan en son + TCP/IP yamalarını uygulanarak bu önlenebilir. Satıcının hiçbir yeni + yama dağıtmadığı durumlarda (örneğin, SunOS4 -- bir kaynak lisansı ile + insanlar bunu kendileri yamayabilirse de) bu özelliği devre dışı + bırakmaya karar verdik.</p> + + <p>Bunun üstesinden gelmenin iki yolu vardır. Bunlardan biri + <code>SO_LINGER</code> soket seçeneğidir. Bu işin kaderi buymuş gibi + görünürse de çoğu TCP/IP yığıtında bu gerektiği gibi + gerçeklenmemiştir. Bu yığıtlar üzerinde, bu yöntemin, doğru bir + gerçeklenimle bile (örneğin, Linux 2.0.31) sonraki çözümden daha + pahalı olduğu ortaya çıkmıştır.</p> + + <p>Çoğunlukla, Apache bunu (<code>http_main.c</code> içindeki) + <code>lingering_close</code> adında bir işlevle gerçekler. Bu işlev + kabaca şöyle görünür:</p> + + <pre class="prettyprint lang-c"> void lingering_close (int s) + { + char junk_buffer[2048]; + + /* shutdown the sending side */ + shutdown (s, 1); + + signal (SIGALRM, lingering_death); + alarm (30); + + for (;;) { + select (s for reading, 2 second timeout); + if (error) break; + if (s is ready for reading) { + if (read (s, junk_buffer, sizeof (junk_buffer)) <= 0) { + break; + } + /* just toss away whatever is here */ + } + } + + close (s); + }</pre> + + + <p>Bağlantı sonunda bu doğal olarak biraz daha masrafa yol açar, fakat + güvenilir bir gerçeklenim için bu gereklidir. HTTP/1.1'in daha yaygın + kullanılmaya başlanması ve tüm bağlantıların kalıcı hale gelmesiyle bu + gerçeklenim daha fazla istek üzerinden kendi masrafını + karşılayacaktır. Ateşle oynamak ve bu özelliği devre dışı bırakmak + isterseniz <code>NO_LINGCLOSE</code>'u tanımlayabilirsiniz, fakat bu + asla önerilmez. Özellikle, HTTP/1.1'den itibaren boruhatlı kalıcı + bağlantıların <code>lingering_close</code> kullanmaya başlaması mutlak + bir gerekliliktir (ve <a href="http://www.w3.org/Protocols/HTTP/Performance/Pipeline.html"> + boruhatlı bağlantıların daha hızlı</a> olması nedeniyle bu + bağlantıları desteklemek isteyebilirsiniz).</p> + + + + <h3>Çetele Dosyası</h3> + + + + <p>Apache'nin ana ve alt süreçleri birbirleriyle çetele denen birşey + üzerinden haberleşirler. Bunun en mükemmel şekilde paylaşımlı bellekte + gerçeklenmesi gerekir. Eriştiğimiz veya portlarını ayrıntılı olarak + belirttiğimiz işletim sistemleri için bu, genellikle paylaşımlı bellek + kullanılarak gerçeklenir. Geri kalanlar, öntanımlı olarak bunu bir + disk dosyası kullanarak gerçekler. Bir disk dosyaı yavaş olmanın yanı + sıra güvenilir de değildir (ve daha az özelliğe sahiptir). Mimarinizin + <code>src/main/conf.h</code> dosyasını inceleyin ve + <code>USE_MMAP_SCOREBOARD</code> veya + <code>USE_SHMGET_SCOREBOARD</code>'a bakın. Bu ikisinden birinin (ve + yanı sıra sırasıyla <code>HAVE_MMAP</code> veya + <code>HAVE_SHMGET</code>'in) tanımlanmış olması, sağlanan paylaşımlı + bellek kodunu etkinleştirir. Eğer sisteminiz diğer türdeki paylaşımlı + belleğe sahipse, <code>src/main/http_main.c</code> dosyasını açıp, + Apache'de bu belleği kullanması gereken kanca işlevleri ekleyin (Bize + de bir yama yollayın, lütfen).</p> + + <div class="note">Tarihsel bilgi: Apache'nin Linux uyarlaması, Apache'nin 1.2 + sürümüne kadar paylaşımlı belleği kullanmaya başlamamıştı. Bu kusur, + Apache'nin Linux üzerindeki erken dönem sürümlerinin davranışlarının + zayıf ve güvenilmez olmasına yol açmıştı.</div> + + + + <h3>DYNAMIC_MODULE_LIMIT</h3> + + + + <p>Devingen olarak yüklenen modülleri kullanmamak niyetindeyseniz + (burayı okuyan ve sunucunuzun başarımını son kırıntısına kadar + arttırmakla ilgilenen biriyseniz bunu düşünmezsiniz), sunucunuzu + derlerken seçenekler arasına <code>-DDYNAMIC_MODULE_LIMIT=0</code> + seçeneğini de ekleyin. Bu suretle, sadece, devingen olarak yüklenen + modüller için ayrılacak belleği kazanmış olacaksınız.</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">Ek: Bir çağrı izlemesinin ayrıntılı çözümlemesi</a></h2> + + + + <p>Burada, Solaris 8 üzerinde worker MPM'li Apache 2.0.38'in bir sistem + çağrısı izlenmektedir. Bu izleme şu komutla elde edilmiştir:</p> + + <div class="example"><p><code> + truss -l -p <var>httpd_çocuk_pidi</var>. + </code></p></div> + + <p><code>-l</code> seçeneği, truss'a hafif bir sürecin yaptığı her + sistem çağrısını (hafif süreç -- HS -- Solaris'in bir çekirdek seviyesi + evreleme biçimi) günlüğe yazmasını söyler.</p> + + <p>Diğer sistemlerin sistem çağrılarını izleyen farklı araçları vardır + (<code>strace</code>, <code>ktrace</code>, <code>par</code> gibi). + Bunlar da benzer çıktılar üretirler.</p> + + <p>Bu izleme sırasında, bir istemci httpd'den 10 KB'lık duruk bir dosya + talebinde bulunmuştur. Duruk olmayan veya içerik uzlaşımlı isteklerin + izleme kayıtları vahşice (bazı durumlarda epey çirkince) farklı + görünür.</p> + + <div class="example"><p><code> + /67: accept(3, 0x00200BEC, 0x00200C0C, 1) (uykuda...)<br /> + /67: accept(3, 0x00200BEC, 0x00200C0C, 1) = 9 + </code></p></div> + + <p>Bu izlemede, dinleyen evre HS #67 içinde çalışmaktadır.</p> + + <div class="note"><code>accept(2)</code> dizgelemesinin olmayışına dikkat edin. + Özellikle bu platformda worker MPM, çok sayıda portu dinlemedikçe, + öntanımlı olarak dizgeleştirilmemiş bir accept çağrısı kullanır.</div> + + <div class="example"><p><code> + /65: lwp_park(0x00000000, 0) = 0<br /> + /67: lwp_unpark(65, 1) = 0 + </code></p></div> + + <p>Bağlantının kabul edilmesiyle, dinleyici evre isteği yerine getirmek + üzere bir worker evresini uyandırır. Bu izlemede, isteği yerine getiren + worker evresi HS #65'e aittir.</p> + + <div class="example"><p><code> + /65: getsockname(9, 0x00200BA4, 0x00200BC4, 1) = 0 + </code></p></div> + + <p>Sanal konakların gerçeklenimi sırasında, Apache'nin, bağlantıları + kabul etmek için kullanılan yerel soket adreslerini bilmesi gerekir. + Çoğu durumda bu çağrıyı bertaraf etmek mümkündür (hiç sanal konağın + olmadığı veya <code class="directive"><a href="../mod/mpm_common.html#listen">Listen</a></code> + yönergelerinin mutlak adreslerle kullanıldığı durumlarda). Fakat bu en + iyilemeleri yapmak için henüz bir çaba harcanmamıştır.</p> + + <div class="example"><p><code> + /65: brk(0x002170E8) = 0<br /> + /65: brk(0x002190E8) = 0 + </code></p></div> + + <p><code>brk(2)</code> çağrıları devingen bellekten bellek ayırır. httpd + çoğu isteği yerine getirirken özel bellek ayırıcılar + (<code>apr_pool</code> ve <code>apr_bucket_alloc</code>) kullandığından + bunlar bir sistem çağrısı izlemesinde nadiren görünür. Bu izlemede, + httpd henüz yeni başlatıldığından, özel bellek ayırıcıları oluşturmak + için ham bellek bloklarını ayırmak amacıyla <code>malloc(3)</code> + çağrıları yapması gerekir.</p> + + <div class="example"><p><code> +/65: fcntl(9, F_GETFL, 0x00000000) = 2<br /> +/65: fstat64(9, 0xFAF7B818) = 0<br /> +/65: getsockopt(9, 65535, 8192, 0xFAF7B918, 0xFAF7B910, 2190656) = 0<br /> +/65: fstat64(9, 0xFAF7B818) = 0<br /> +/65: getsockopt(9, 65535, 8192, 0xFAF7B918, 0xFAF7B914, 2190656) = 0<br /> +/65: setsockopt(9, 65535, 8192, 0xFAF7B918, 4, 2190656) = 0<br /> +/65: fcntl(9, F_SETFL, 0x00000082) = 0 + </code></p></div> + + <p>Ardından, worker evresi istemciye (dosya tanıtıcısı 9) engellenmeyen + kipte bir bağlantı açar. <code>setsockopt(2)</code> + ve <code>getsockopt(2)</code> çağrıları, Solaris libc'sinin soketler + üzerindeki <code>fcntl(2)</code> çağrısı yanında birer yan etkiden + ibarettirler.</p> + + <div class="example"><p><code> + /65: read(9, " G E T / 1 0 k . h t m".., 8000) = 97 + </code></p></div> + + <p>Worker evresi istemciden isteği okur.</p> + + <div class="example"><p><code> +/65: stat("/var/httpd/apache/httpd-8999/htdocs/10k.html", 0xFAF7B978) = 0<br /> +/65: open("/var/httpd/apache/httpd-8999/htdocs/10k.html", O_RDONLY) = 10 + </code></p></div> + + <p>Bu httpd <code>Options FollowSymLinks</code> ve <code>AllowOverride + None</code> ile yapılandırılmıştır. Bu bakımdan, ne istenen dosya ile + sonuçlanan yol üzerindeki her dizinde <code>lstat(2)</code> çağrısına ne + de <code>.htaccess</code> dosyalarına bakılmasına gerek vardır. + <code>stat(2)</code> çağrısı basitçe dosya için şunları doğrulamak + amacıyla yapılır: 1) dosya mevcuttur ve 2) bir dizin değil normal bir + dosyadır.</p> + + <div class="example"><p><code> + /65: sendfilev(0, 9, 0x00200F90, 2, 0xFAF7B53C) = 10269 + </code></p></div> + + <p>Bu örnekte, httpd, istenen dosyayı ve HTTP yanıt başlığını tek bir + <code>sendfilev(2)</code> sistem çağrısı ile göndermektedir. Dosya + gönderim işleminin anlamı sistemden sisteme değişiklik gösterir. Bazı + sistemlerde, <code>sendfile(2)</code> çağrısından önce başlıkları + göndermek için <code>write(2)</code> veya <code>writev(2)</code> + çağrısı yapmak gerekir.</p> + + <div class="example"><p><code> + /65: write(4, " 1 2 7 . 0 . 0 . 1 - ".., 78) = 78 + </code></p></div> + + <p>Bu <code>write(2)</code> çağrısı isteği erişim günlüğüne kaydeder. Bu + izlemede eksik olan tek şey, <code>time(2)</code> çağrısıdır. Apache + 1.3'ün aksine, Apache 2.x zamana bakmak için + <code>gettimeofday(3)</code> çağırısını kullanır. Linux ve Solaris gibi + bazı işletim sistemleri, <code>gettimeofday</code> işlevinin, sıradan + bir sistem çağrısından daha fazla götürüsü olmayan en iyilenmiş bir + gerçeklenimine sahiptir.</p> + + <div class="example"><p><code> + /65: shutdown(9, 1, 1) = 0<br /> + /65: poll(0xFAF7B980, 1, 2000) = 1<br /> + /65: read(9, 0xFAF7BC20, 512) = 0<br /> + /65: close(9) = 0 + </code></p></div> + + <p>Burada worker evresi bağlantıyı zamana yaymaktadır.</p> + + <div class="example"><p><code> + /65: close(10) = 0<br /> + /65: lwp_park(0x00000000, 0) (uykuda...) + </code></p></div> + + <p>Son olarak, worker evresi teslim edilen dosyayı kapattıktan sonra + dinleyici evre tarafından başka bir bağlantı atanıncaya kadar beklemeye + alınır.</p> + + <div class="example"><p><code> + /67: accept(3, 0x001FEB74, 0x001FEB94, 1) (uykuda...) + </code></p></div> + + <p>Bu arada, dinleyici evre bağlantıyı bir worker evresine atar atamaz + başka bir bağlantıyı beklemeye başlar (Mevcut tüm evreler meşgulse + dinleyici evreyi baskılayan worker MPM'nin akış denetim şemasına konu + olur). Bu izlemede görünmüyor olsa da sonraki <code>accept(2)</code> + çağrısı, yeni bağlantı kabul eden worker evresine paralel olarak + yapılabilir (aşırı yük durumlarında normal olarak, bu yapılır).</p> + + </div></div> +<div class="bottomlang"> +<p><span>Mevcut Diller: </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" hreflang="ko" rel="alternate" title="Korean"> ko </a> | +<a href="../tr/misc/perf-tuning.html" 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">Yorum</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 2019 The Apache Software Foundation.<br /><a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a> altında lisanslıdır.</p> +<p class="menu"><a href="../mod/">Modüller</a> | <a href="../mod/directives.html">Yönergeler</a> | <a href="http://wiki.apache.org/httpd/FAQ">SSS</a> | <a href="../glossary.html">Terimler</a> | <a href="../sitemap.html">Site Haritası</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- +if (typeof(prettyPrint) !== 'undefined') { + prettyPrint(); +} +//--><!]]></script> +</body></html>
\ No newline at end of file |