From 41d8f1e6a164b363f0749807c61cb32b0f0985b8 Mon Sep 17 00:00:00 2001 From: Joshua Slive Date: Sun, 5 Nov 2000 19:52:03 +0000 Subject: [PATCH] Cleanup of perf-tuning.html. No content changes. Submitted by: Chris Pepper , 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 | 63 +++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/docs/manual/misc/perf-tuning.html b/docs/manual/misc/perf-tuning.html index 85a527afa5..e7e1d43044 100644 --- a/docs/manual/misc/perf-tuning.html +++ b/docs/manual/misc/perf-tuning.html @@ -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,11 +56,13 @@ performance out of Apache's current model, and want to understand why 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 @@ -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. -

Run-Time Configuration Issues

+
+ +

Run-Time Configuration Issues

HostnameLookups

Prior to Apache 1.3, HostnameLookups defaulted to On. @@ -225,7 +245,9 @@ In no event should you raise this above about 60 seconds, as most of the benefits are lost. -

Compile-Time Configuration Issues

+
+ +

Compile-Time Configuration Issues

mod_status and ExtendedStatus On

@@ -257,11 +279,11 @@ pedagogical purposes): 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 @@ the inner loop. The loop looks like this (differences highlighted): 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 @@ 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)) <= 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. -

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 @@ large may lock out low bandwidth clients unless you also increase the 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 @@ up to PIPE_BUF bytes (a POSIX defined constant) of log entries 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 @@ these calls are used by few sites but required for backwards compatibility. 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 @@ 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 Netscape's Portable Run Time, which is available @@ -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. + -- 2.50.1