From cb9e6cd9b4292d06c4a2bcb88f94e3f4244d2fc9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Igor=20Gali=C4=87?= Date: Wed, 1 Aug 2012 21:37:52 +0000 Subject: [PATCH] fix formating and some links git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1368265 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/misc/perf-scaling.xml | 385 ++++++++++-------------------- 1 file changed, 127 insertions(+), 258 deletions(-) diff --git a/docs/manual/misc/perf-scaling.xml b/docs/manual/misc/perf-scaling.xml index dd13145414..e0553c61ee 100644 --- a/docs/manual/misc/perf-scaling.xml +++ b/docs/manual/misc/perf-scaling.xml @@ -28,15 +28,14 @@

The Performance Tuning page in the Apache 1.3 documentation says:

- + webserver.”

+

However, this sentence was written a few years ago, and in the meantime several things have happened. On one hand, web server hardware has become much faster. On the other hand, many sites now @@ -91,7 +90,7 @@ top

The top tool ships with Linux and FreeBSD. Solaris offers - `prstat'. It collects a number of statistics for the + prstat(1). It collects a number of statistics for the system and for each running process, then displays them interactively on your terminal. The data displayed is refreshed every second and varies by platform, but @@ -179,10 +178,8 @@ top ten CPU gluttons). It is indispensable in determining the size of a running process, which comes in handy when determining how many server processes you can run on your - machine. How to do this is described in ' - sizing MaxClients - - '. Top is, however, an interactive tool and running it + machine. How to do this is described in sizing MaxClients. + Top is, however, an interactive tool and running it continuously has few if any advantages.

@@ -194,10 +191,8 @@ memory as file system cache. The free command shows usage both with and without this cache. The free command can be used to find out how much memory the operating system is - using, as described in the paragraph ' - Sizing MaxClients - - '. The output of free looks like this: + using, as described in the paragraph sizing MaxClients. + The output of free looks like this:

@@ -217,9 +212,8 @@ displays a large number of operating system metrics. Run without argument, it displays a status line for that moment. When a numeric argument is added, the status is - redisplayed at designated intervals. For example, - vmstat 5 - + redisplayed at designated intervals. For example, + vmstat 5 causes the information to reappear every five seconds. Vmstat displays the amount of virtual memory in use, how much memory is swapped in and out each second, the number @@ -228,9 +222,7 @@ percentages of the CPU.

- The following is vmstat - - output of an idle server: + The following is vmstat output of an idle server:

@@ -319,15 +311,11 @@ with, among others, the number of Apache processes running and how many bytes each has served, and the CPU load caused by httpd and the rest of the system. The Apache Software - Foundation uses mod_status on its own - web site - - .If you put the ExtendedStatus On - - directive in your httpd.conf - - ,the mod_status - + Foundation uses mod_status on its own + web site. + If you put the ExtendedStatus On + directive in your httpd.conf, + the mod_status page will give you more information at the cost of a little extra work per request.

@@ -370,24 +358,20 @@ this error information will appear on your terminal and you can use it directly to troubleshoot your server. If your httpd is started by a startup script, the destination of - early error messages depends on their design. The - /var/log/messages - + early error messages depends on their design. The + /var/log/messages file is usually a good bet. On Windows, early error messages are written to the Applications Event Log, which can be viewed through the Event Viewer in Administrative Tools.

- The Error Log is configured through the ErrorLog - - and LogLevel - + The Error Log is configured through the ErrorLog + and LogLevel configuration directives. The error log of httpd’s main server configuration receives the log messages that pertain to the entire server: startup, shutdown, crashes, excessive - process spawns, etc. The ErrorLog - + process spawns, etc. The ErrorLog directive can also be used in virtual host containers. The error log of a virtual host receives only log messages specific to that virtual host, such as authentication @@ -400,118 +384,92 @@ attack scripts just throw everything they have at any open port, regardless of which server is actually running or what applications might be installed. You could block these - attempts using a firewall or - mod_security - - ,but this falls outside the scope of this discussion. + attempts using a firewall or mod_security, + but this falls outside the scope of this discussion.

- The LogLevel - + The LogLevel directive determines the level of detail included in the logs. There are eight log levels as described here:

-

- Level - -

+

Level

-

- Description - -

+

Description

-

emerg -

+

emerg

-

Emergencies - system is unusable. -

+

Emergencies - system is unusable.

-

alert -

+

alert

-

Action must be taken immediately. -

+

Action must be taken immediately.

-

crit -

+

crit

-

Critical Conditions. -

+

Critical Conditions.

-

error -

+

error

-

Error conditions. -

+

Error conditions.

-

warn -

+

warn

-

Warning conditions. -

+

Warning conditions.

-

notice -

+

notice

-

Normal but significant condition. -

+

Normal but significant condition.

-

info -

+

info

-

Informational. -

+

Informational.

-

debug -

+

debug

-

Debug-level messages -

+

Debug-level messages

The default log level is warn. A production server should not be run on debug, but increasing the level of detail in the error log can be useful during troubleshooting. - Starting with 2.3.8 LogLevel - + Starting with 2.3.8 LogLevel can be specified on a per module basis:

@@ -520,10 +478,8 @@

- This puts all of the server in debug mode, except for - mod_ssl - - ,which tends to be very noisy. + This puts all of the server in debug mode, except for + mod_ssl, which tends to be very noisy.

@@ -535,14 +491,10 @@ access log file. In addition to the time and nature of a request, httpd can log the client IP address, date and time of the request, the result and a host of other information. - The various logging format features are documented in the - manual - - .This file exists by default for the main server and can be - configured per virtual host by using the TransferLog - - or CustomLog - + The various logging format features are documented in the + manual. This file exists by default for the main server and can be + configured per virtual host by using the TransferLog + or CustomLog configuration directive.

The access logs can be analyzed with any of several free and @@ -575,121 +527,90 @@
-

- Field - -

+

Field

-

- Content - -

+

Content

-

- Explanation - -

+

Explanation

-

Client IP -

+

Client IP

-

195.54.228.42 -

+

195.54.228.42

-

IP address where the request originated -

+

IP address where the request originated

-

RFC 1413 ident -

+

RFC 1413 ident

-

- -

+

-

-

Remote user identity as reported by their - identd -

+

Remote user identity as reported by their identd

-

username -

+

username

-

- -

+

-

-

Remote username as authenticated by Apache -

+

Remote username as authenticated by Apache

-

timestamp -

+

timestamp

-

[24/Mar/2007:23:05:11 -0400] -

+

[24/Mar/2007:23:05:11 -0400]

-

Date and time of request -

+

Date and time of request

-

Request -

+

Request

-

"GET /sander/feed/ HTTP/1.1" -

+

"GET /sander/feed/ HTTP/1.1"

-

Request line -

+

Request line

-

Status Code -

+

Status Code

-

200 -

+

200

-

Response code -

+

Response code

-

Content Bytes -

+

Content Bytes

-

9747 -

+

9747

-

Bytes transferred w/o headers -

+

Bytes transferred w/o headers

@@ -740,17 +661,13 @@ timing of your restarts.

- A second approach is to use piped logs. From the - CustomLog - - ,TransferLog - - or ErrorLog - + A second approach is to use piped logs. From the + CustomLog, + TransferLog + or ErrorLog + directives you can send the log data into any program using - a pipe character (| - - ). For instance: + a pipe character (|). For instance:

CustomLog "|/usr/local/apache2/bin/rotatelogs @@ -783,10 +700,8 @@ disk sequentially.

- Do not run a production server with your error - LogLevel - - set to debug. This log level causes a vast amount of + Do not run a production server with your error LogLevel + set to debug. This log level causes a vast amount of information to be written to the error log, including, in the case of SSL access, complete dumps of BIO read and write operations. The performance implications are @@ -807,8 +722,7 @@ under support/split-logfile.

- You can use the BufferedLogs - + You can use the BufferedLogs directive to have Apache collect several log lines in memory before writing them to disk. This might yield better performance, but could affect the order in which the @@ -960,8 +874,7 @@ that all the memory on your system is used, but no more. If your system gets so overloaded that it needs to heavily swap core memory out to disk, performance will degrade - quickly. The formula for determining MaxClients - + quickly. The formula for determining MaxClients is fairly simple:

@@ -1280,21 +1193,15 @@ In FreeBSD's /etc/login.conf these resources can be limited or extended system wide, - analogously to limits.conf - - .'Soft' limits can be specified with -cur - - and 'hard' limits with -max - - . + analogously to limits.conf. + 'Soft' limits can be specified with -cur + and 'hard' limits with -max.

Solaris has a similar mechanism for manipulating limit - values at boot time: In /etc/system - + values at boot time: In /etc/system you can set kernel tunables valid for the entire system at boot time. These are the same tunables that can be set with - the mdb - + the mdb kernel debugger during run time. The soft and hard limit corresponding to ulimit -u can be set via:

@@ -1305,12 +1212,9 @@

Solaris calculates the maximum number of allowed processes - per user (maxuprc - - )based on the total amount available memory on the system ( - maxusers - - ). You can review the numbers with + per user (maxuprc) based on the total amount + available memory on the system (maxusers). + You can review the numbers with

sysdef -i | grep maximum @@ -1331,26 +1235,21 @@ etc. Turn them off.

On Red Hat Linux, the chkconfig tool will help you do this - from the command line. On Solaris systems svcs - - and svcadm - + from the command line. On Solaris systems svcs + and svcadm will show which services are enabled and disable them respectively.

In a similar fashion, cast a critical eye on the Apache modules you load. Most binary distributions of Apache httpd, and pre-installed versions that come with Linux - distributions, have their modules enabled through the - LoadModule - - directive. + distributions, have their modules enabled through the + LoadModule directive.

Unused modules may be culled: if you don't rely on their functionality and configuration directives, you can - turn them off by commenting out the corresponding - LoadModule - + turn them off by commenting out the corresponding + LoadModule lines. Read the documentation on each module’s functionality before deciding whether to keep it enabled. While the performance overhead of an unused module is @@ -1401,12 +1300,9 @@

Example: A Statically Rendered Blog -

- 'we should provide a more useful example here. - One showing how to make Wordpress or Drupal suck less. - - ' -

+ +

Blosxom is a lightweight web log package that runs as a CGI. It is written in Perl and uses plain text files for entry input. Besides running as CGI, Blosxom can be run from the @@ -1417,8 +1313,7 @@

To run blosxom for static page generation, edit the CGI script according to the documentation. Set the $static dir - variable to the DocumentRoot - + variable to the DocumentRoot of the web server, and run the script from the command line as follows:

@@ -1431,11 +1326,9 @@ rendered pages for the dynamic content, we’ll use mod_rewrite. This module is included with the Apache source code, but is not compiled by default. It can be built with - the server by passing the option - --enable-rewrite[=shared] - + the server by passing the option --enable-rewrite[=shared] to the configure command. Many binary distributions of - Apache come with mod_rewrite included. The following is an + Apache come with mod_rewrite included. The following is an example of an Apache virtual host that takes advantage of pre-rendered blog pages:

@@ -1478,10 +1371,8 @@

- The RewriteCond - - and RewriteRule - + The RewriteCond + and RewriteRule directives say that, if the requested resource does not exist as a file or a directory, its path is passed to the Blosxom CGI for rendering. Blosxom uses Path Info to @@ -1520,34 +1411,26 @@

To enable efficient content caching and avoid presenting the user with stale or invalid content, the application that generates the actual content has to send the correct response - headers. Without headers like Etag: - - ,Last-Modified: - - or Expires: - - ,mod_cache can not make the right decision on whether to cache + headers. Without headers like Etag:, + Last-Modified: or Expires:, + mod_cache can not make the right decision on whether to cache the content, serve it from cache or leave it alone. When testing content caching, you may find that you need to modify your application or, if this is impossible, selectively disable caching for URLs that cause problems. The mod_cache modules are not compiled by default, but can be enabled by passing the - option --enable-cache[=shared] - + option --enable-cache[=shared] to the configure script. If you use a binary distribution of Apache httpd, or it came with your port or package collection, - it may have mod_cache already included. + it may have mod_cache already included.

Example: wiki.apache.org -

- 'Is this still the case? Maybe we should give - a better example here too. - -

+

The Apache Software Foundation Wiki is served by MoinMoin. MoinMoin is written in Python and runs as a CGI. To date, any @@ -1563,9 +1446,7 @@ the corresponding Python modules were patched to send the proper HTTP response headers. After this modification, the cache in front of the Wiki was enabled with the following - configuration snippet in httpd.conf - - : + configuration snippet in httpd.conf:

@@ -1579,29 +1460,22 @@

This configuration will try to cache any and all content within its virtual host. It will never cache content for - more than six hours (the CacheMaxExpire - - directive). If no Expires: - - header is present in the response, mod_cache will compute - an expiration period from the Last-Modified: - - header. The computation using CacheLastModifiedFactor - + more than six hours (the CacheMaxExpire + directive). If no Expires: + header is present in the response, mod_cache will compute + an expiration period from the Last-Modified: + header. The computation using CacheLastModifiedFactor is based on the assumption that if a page was recently modified, it is likely to change again in the near future and will have to be re-cached.

- Do note that it can pay off to disable - - the ETag: - + Do note that it can pay off to disable + the ETag: header: For files smaller than 1k the server has to - calculate the checksum (usually MD5) and then send out a - 304 Not Modified - - response, which will take waste some CPU and still saturate + calculate the checksum (usually MD5) and then send out a + 304 Not Modified + response, which will use up some CPU and still saturate the same amount of network resources for the transfer (one TCP packet). For resources larger than 1k it might prove CPU expensive to calculate the header for each request. @@ -1617,8 +1491,7 @@

- This will disable the generation of the ETag: - + This will disable the generation of the ETag: header for most static resources. The server does not calculate these headers for dynamic resources.

@@ -1631,14 +1504,10 @@ Further Considerations

Armed with the knowledge of how to tune a sytem to deliver the - desired the performance, we will soon discover that one - + desired the performance, we will soon discover that one system might prove a bottleneck. How to make a system fit for growth, or how to put a number of systems into tune will be - discussed in - PerformanceScalingOut - - . + discussed in PerformanceScalingOut.

-- 2.49.0