]> granicus.if.org Git - apache/commitdiff
Cleanup of perf-tuning.html. No content changes.
authorJoshua Slive <slive@apache.org>
Sun, 5 Nov 2000 19:52:03 +0000 (19:52 +0000)
committerJoshua Slive <slive@apache.org>
Sun, 5 Nov 2000 19:52:03 +0000 (19:52 +0000)
Submitted by: Chris Pepper <pepper@mail.reppep.com>, Joshua Slive

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86841 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/misc/perf-tuning.html

index 85a527afa56135cd6a00d4e6e72086b44ab0d5dc..e7e1d43044eeaa64069b266e25507404c88b153a 100644 (file)
  VLINK="#000080"
  ALINK="#FF0000"
 >
-<H1>Apache Performance Notes</H1>
+<!--#include virtual="header.html" -->
+<H1 align="center">Apache Performance Notes</H1>
 
 <P>Author: Dean Gaudet
 
-<H3>Introduction</H3>
+<ul>
+<li><a href="#introduction">Introduction</a></li>
+<li><a href="#hardware">Hardware and Operating System Issues</a></li>
+<li><a href="#runtime">Run-Time Configuration Issues</a></li>
+<li><a href="#compiletime">Compile-Time Configuration Issues</a></li>
+<li>Appendixes
+  <ul>
+  <li><a href="#trace">Detailed Analysis of a Trace</a></li>
+  <li><a href="#patches">Patches Available</a></li>
+  <li><a href="#preforking">The Pre-Forking Model</a></li>
+  </ul></li>
+</ul>
+
+<hr>
+
+<H3><a name="introduction">Introduction</A></H3>
 <P>Apache is a general webserver, which is designed to be correct first, and
 fast second.  Even so, its performance is quite satisfactory.  Most
 sites have less than 10Mbits of outgoing bandwidth, which Apache can
@@ -40,11 +56,13 @@ performance out of Apache's current model, and want to understand why
 it does some things which slow it down.
 
 <P>Note that this is tailored towards Apache 1.3 on Unix.  Some of it applies
-to Apache on NT.  Apache on NT has not been tuned for performance yet,
+to Apache on NT.  Apache on NT has not been tuned for performance yet;
 in fact it probably performs very poorly because NT performance requires
 a different programming model.
 
-<H3>Hardware and Operating System Issues</H3>
+<hr>
+
+<H3><a name="hardware">Hardware and Operating System Issues</a></H3>
 
 <P>The single biggest hardware issue affecting webserver performance
 is RAM.  A webserver should never ever have to swap, swapping increases
@@ -64,7 +82,9 @@ HTTP serving completely breaks many of the assumptions built into Unix
 kernels up through 1994 and even 1995.  Good choices include
 recent FreeBSD, and Linux.
 
-<H3>Run-Time Configuration Issues</H3>
+<hr>
+
+<H3><a name="runtime">Run-Time Configuration Issues</a></H3>
 
 <H4>HostnameLookups</H4>
 <P>Prior to Apache 1.3, <CODE>HostnameLookups</CODE> defaulted to On.
@@ -225,7 +245,9 @@ In no event should you raise this above about 60 seconds, as
 <A HREF="http://www.research.digital.com/wrl/techreports/abstracts/95.4.html"
 >most of the benefits are lost</A>.
 
-<H3>Compile-Time Configuration Issues</H3>
+<hr>
+
+<H3><a name="compiletime">Compile-Time Configuration Issues</a></H3>
 
 <H4>mod_status and ExtendedStatus On</H4>
 
@@ -257,11 +279,11 @@ pedagogical purposes):
        for (;;) {
            fd_set accept_fds;
 
-           FD_ZERO (&accept_fds);
+           FD_ZERO (&amp;accept_fds);
            for (i = first_socket; i &lt;= last_socket; ++i) {
-               FD_SET (i, &accept_fds);
+               FD_SET (i, &mp;accept_fds);
            }
-           rc = select (last_socket+1, &accept_fds, NULL, NULL, NULL);
+           rc = select (last_socket+1, &amp;accept_fds, NULL, NULL, NULL);
            if (rc &lt; 1) continue;
            new_connection = -1;
            for (i = first_socket; i &lt;= last_socket; ++i) {
@@ -315,15 +337,15 @@ the inner loop.  The loop looks like this (differences highlighted):
        for (;;) {
            fd_set accept_fds;
 
-           FD_ZERO (&accept_fds);
+           FD_ZERO (&amp;accept_fds);
            for (i = first_socket; i &lt;= last_socket; ++i) {
-               FD_SET (i, &accept_fds);
+               FD_SET (i, &amp;accept_fds);
            }
-           rc = select (last_socket+1, &accept_fds, NULL, NULL, NULL);
+           rc = select (last_socket+1, &amp;accept_fds, NULL, NULL, NULL);
            if (rc &lt; 1) continue;
            new_connection = -1;
            for (i = first_socket; i &lt;= last_socket; ++i) {
-               if (FD_ISSET (i, &accept_fds)) {
+               if (FD_ISSET (i, &amp;accept_fds)) {
                    new_connection = accept (i, NULL, NULL);
                    if (new_connection != -1) break;
                }
@@ -475,7 +497,7 @@ function looks roughly like this:
            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) {
+               if (read (s, junk_buffer, sizeof (junk_buffer)) &lt;= 0) {
                    break;
                }
                /* just toss away whatever is here */
@@ -529,7 +551,9 @@ server for every last ounce of performance) then you should add
 This will save RAM that's allocated only for supporting dynamically
 loaded modules.
 
-<H3>Appendix: Detailed Analysis of a Trace</H3>
+<hr>
+
+<H3><a name="trace">Appendix: Detailed Analysis of a Trace</a></H3>
 
 Here is a system call trace of Apache 1.3 running on Linux.  The run-time
 configuration file is essentially the default plus:
@@ -721,7 +745,7 @@ large may lock out low bandwidth clients unless you also increase the
 <CODE>Timeout</CODE>.
 
 <P>It may even be the case that <CODE>mmap</CODE> isn't
-used on your architecture, if so then defining <CODE>USE_MMAP_FILES</CODE>
+used on your architecture; if so then defining <CODE>USE_MMAP_FILES</CODE>
 and <CODE>HAVE_MMAP</CODE> might work (if it works then report back to us).
 
 <P>Apache does its best to avoid copying bytes around in memory.  The
@@ -753,7 +777,7 @@ up to <CODE>PIPE_BUF</CODE> bytes (a POSIX defined constant) of log entries
 are buffered before writing.  At no time does it split a log entry
 across a <CODE>PIPE_BUF</CODE> boundary because those writes may not
 be atomic.  (<EM>i.e.</EM>, entries from multiple children could become mixed together).
-The code does it best to flush this buffer when a child dies.
+The code does its best to flush this buffer when a child dies.
 
 <P>The lingering close code causes four system calls:
 
@@ -818,7 +842,7 @@ these calls are used by few sites but required for backwards compatibility.
 cost of removing some functionality.
 </UL>
 
-<H3>Appendix: The Pre-Forking Model</H3>
+<H3><a name="preforking">Appendix: The Pre-Forking Model</a></H3>
 
 <P>Apache (on Unix) is a <EM>pre-forking</EM> model server.  The
 <EM>parent</EM> process is responsible only for forking <EM>child</EM>
@@ -857,7 +881,7 @@ depending on the operating system.
 1.3 is multithreaded on NT.  There have been at least two other experimental
 implementations of threaded Apache, one using the 1.3 code base on DCE,
 and one using a custom user-level threads package and the 1.0 code base;
-neither is available publically.  There is also an experimental port of
+neither is publicly available.  There is also an experimental port of
 Apache 1.3 to <A HREF="http://www.mozilla.org/docs/refList/refNSPR/">
 Netscape's Portable Run Time</A>, which
 <A HREF="http://www.arctic.org/~dgaudet/apache/2.0/">is available</A>
@@ -869,5 +893,6 @@ of Apache will include abstractions of the server model so that we
 can continue to support the pre-forking model, and also support various
 threaded models.
 
+<!--#include virtual="footer.html" -->
 </BODY>
 </HTML>