Return-Path: Delivered-To: apmail-apache-cvs-archive@apache.org Received: (qmail 14154 invoked by uid 500); 5 Nov 2000 19:48:32 -0000 Mailing-List: contact apache-cvs-help@apache.org; run by ezmlm Precedence: bulk Reply-To: new-httpd@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list apache-cvs@apache.org Received: (qmail 14131 invoked by uid 500); 5 Nov 2000 19:48:31 -0000 Delivered-To: apmail-apache-1.3-cvs@apache.org Delivered-To: apmail-httpd-docs-1.3-cvs@apache.org Date: 5 Nov 2000 19:48:31 -0000 Message-ID: <20001105194831.14117.qmail@locus.apache.org> From: slive@locus.apache.org To: httpd-docs-1.3-cvs@apache.org Subject: cvs commit: httpd-docs-1.3/htdocs/manual/misc perf-tuning.html slive 00/11/05 11:48:30 Modified: htdocs/manual/misc perf-tuning.html Log: Some cleanups of perf-tuning. Nothing content-related is changed. Submitted by: Chris Pepper , Joshua Slive Revision Changes Path 1.22 +44 -19 httpd-docs-1.3/htdocs/manual/misc/perf-tuning.html Index: perf-tuning.html =================================================================== RCS file: /home/cvs/httpd-docs-1.3/htdocs/manual/misc/perf-tuning.html,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- perf-tuning.html 2000/09/12 02:29:10 1.21 +++ perf-tuning.html 2000/11/05 19:48:30 1.22 @@ -11,11 +11,27 @@ VLINK="#000080" ALINK="#FF0000" > -

Apache Performance Notes

+ +

Apache Performance Notes

Author: Dean Gaudet -

Introduction

+ + +
+ +

Introduction

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,12 +56,14 @@ it does some things which slow it down.

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. -

Hardware and Operating System Issues

+
+

Hardware and Operating System Issues

+

The single biggest hardware issue affecting webserver performance is RAM. A webserver should never ever have to swap, swapping increases the latency of each request beyond a point that users consider "fast @@ -63,8 +81,10 @@ 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. + +


-

Run-Time Configuration Issues

+

Run-Time Configuration Issues

HostnameLookups

Prior to Apache 1.3, HostnameLookups defaulted to On. @@ -225,8 +245,10 @@ most of the benefits are lost. -

Compile-Time Configuration Issues

+
+

Compile-Time Configuration Issues

+

mod_status and ExtendedStatus On

If you include mod_status @@ -257,11 +279,11 @@ for (;;) { fd_set accept_fds; - FD_ZERO (&accept_fds); + FD_ZERO (&accept_fds); for (i = first_socket; i <= last_socket; ++i) { - FD_SET (i, &accept_fds); + FD_SET (i, ∓accept_fds); } - rc = select (last_socket+1, &accept_fds, NULL, NULL, NULL); + 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) { @@ -315,15 +337,15 @@ for (;;) { fd_set accept_fds; - FD_ZERO (&accept_fds); + FD_ZERO (&accept_fds); for (i = first_socket; i <= last_socket; ++i) { - FD_SET (i, &accept_fds); + FD_SET (i, &accept_fds); } - rc = select (last_socket+1, &accept_fds, NULL, NULL, NULL); + 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)) { + if (FD_ISSET (i, &accept_fds)) { new_connection = accept (i, NULL, NULL); if (new_connection != -1) break; } @@ -475,7 +497,7 @@ 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)) <= 0) { break; } /* just toss away whatever is read */ @@ -528,8 +550,10 @@ -DDYNAMIC_MODULE_LIMIT=0 when building your server. This will save RAM that's allocated only for supporting dynamically loaded modules. + +


-

Appendix: Detailed Analysis of a Trace

+

Appendix: Detailed Analysis of a Trace

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 @@ Timeout.

It may even be the case that mmap isn't -used on your architecture, if so then defining USE_MMAP_FILES +used on your architecture; if so then defining USE_MMAP_FILES and HAVE_MMAP might work (if it works then report back to us).

Apache does its best to avoid copying bytes around in memory. The @@ -753,7 +777,7 @@ are buffered before writing. At no time does it split a log entry across a PIPE_BUF boundary because those writes may not be atomic. (i.e., 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.

The lingering close code causes four system calls: @@ -818,7 +842,7 @@ cost of removing some functionality. -

Appendix: The Pre-Forking Model

+

Appendix: The Pre-Forking Model

Apache (on Unix) is a pre-forking model server. The parent process is responsible only for forking child @@ -857,7 +881,7 @@ 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 Netscape's Portable Run Time, which is available @@ -869,5 +893,6 @@ can continue to support the pre-forking model, and also support various threaded models. +