\r
</summary>\r
\r
- <section id="What Will and Will Not Be Discussed">\r
+ <section id="what-will-and-will-not-be-discussed">\r
<title>What Will and Will Not Be Discussed\r
</title>\r
<p>The session will focus on easily accessible configuration and tuning\r
options for Apache httpd 2.2 and 2.3 as well as monitoring tools.\r
Monitoring tools will allow you to observe your web server to\r
gather information about its performance, or lack thereof.\r
- We'll assume that you don't have an unlimited budget for\r
+ We'll assume that you don't have an unlimited budget for\r
server hardware, so the existing infrastructure will have to do the\r
job. You have no desire to compile your own Apache, or to recompile\r
the operating system kernel. We do assume, though, that you have\r
\r
</section>\r
\r
- <section id="Monitoring Your Server">\r
+ <section id="monitoring-your-server">\r
<title>Monitoring Your Server\r
</title>\r
<p>The first task when sizing or performance-tuning your server is to\r
</p>\r
\r
\r
- <section id="Monitoring Tools">\r
+ <section id="monitoring-tools">\r
<title>Monitoring Tools\r
</title>\r
\r
<title>top\r
</title>\r
<p>The top tool ships with Linux and FreeBSD. Solaris offers\r
- `prstat'. It collects a number of statistics for the\r
+ `prstat'. It collects a number of statistics for the\r
system and for each running process, then displays them\r
interactively on your terminal. The data displayed is\r
refreshed every second and varies by platform, but\r
top ten CPU gluttons). It is indispensable in determining\r
the size of a running process, which comes in handy when\r
determining how many server processes you can run on your\r
- machine. How to do this is described in '<a href="/httpd/PerformanceScalingUp#S">\r
+ machine. How to do this is described in '<a href="/httpd/PerformanceScalingUp#S">\r
sizing MaxClients\r
</a>\r
- '. Top is, however, an interactive tool and running it\r
+ '. Top is, however, an interactive tool and running it\r
continuously has few if any advantages. \r
</p>\r
</section>\r
memory as file system cache. The free command shows usage\r
both with and without this cache. The free command can be\r
used to find out how much memory the operating system is\r
- using, as described in the paragraph '<a href="/httpd/PerformanceScalingUp#S">\r
+ using, as described in the paragraph '<a href="/httpd/PerformanceScalingUp#S">\r
Sizing MaxClients\r
</a>\r
- '. The output of free looks like this: \r
+ '. The output of free looks like this: \r
</p>\r
\r
<example>\r
\r
\r
</section>\r
- <section id="SE Toolkit">\r
+ <section id="se-toolkit">\r
<title>SE Toolkit\r
</title>\r
<p>The SE Toolkit is a system monitoring toolkit for Solaris.\r
\r
\r
</section>\r
- <section id="DTrace">\r
+ <section id="dtrace">\r
<title>DTrace\r
</title>\r
<p>Given that DTrace is available for Solaris, FreeBSD and OS\r
- X, it might be worth exploring it. There's also\r
+ X, it might be worth exploring it. There's also\r
mod_dtrace available for httpd. \r
</p>\r
\r
\r
</section>\r
</section>\r
- <section id="Web Server Log Files">\r
+ <section id="web-server-log-files">\r
<title>Web Server Log Files\r
</title>\r
<p>Monitoring and analyzing the log files httpd writes is one of\r
</p>\r
\r
\r
- <section id="Error Log">\r
+ <section id="ErrorLog">\r
<title>Error Log\r
</title>\r
<p>The error log will contain messages if the server has\r
directive can also be used in virtual host containers. The\r
error log of a virtual host receives only log messages\r
specific to that virtual host, such as authentication\r
- failures and 'File not Found' errors. \r
+ failures and 'File not Found' errors. \r
</p>\r
<p>On a server that is visible to the Internet, expect to see a\r
lot of exploit attempt and worm attacks in the error log. A\r
\r
\r
</section>\r
- <section id="Access Log">\r
+ <section id="AccessLog">\r
<title>Access Log\r
</title>\r
<p>Apache httpd keeps track of every request it services in its\r
</table>\r
\r
</section>\r
- <section id="Rotating Log Files">\r
+ <section id="rotating-log-files">\r
<title>Rotating Log Files\r
</title>\r
<p>There are several reasons to rotate logfiles. Even though\r
\r
\r
</section>\r
- <section id="Logging and Performance">\r
+ <section id="logging-and-performance">\r
<title>Logging and Performance\r
</title>\r
<p>Writing entries to the Apache log files obviously takes some\r
easier to analyze the logfile later. However, if your\r
server has many virtual hosts, all the open logfiles put a\r
resource burden on your system, and it may be preferable to\r
- log to a single file. Use the <code>%v\r
- </code>\r
- format character at the start of your <a href="/httpd/LogFormat" class="nonexistent">\r
- LogFormat\r
- </a>\r
- and starting 2.3.8 of your <code>ErrorLogFormat\r
- </code>\r
+ log to a single file. Use the <code>%v</code>\r
+ format character at the start of your <directive module="mod_log_config">LogFormat</directive>\r
+ and starting 2.3.8 of your <directive module="core">ErrorLog</directive>\r
to make httpd print the hostname of the virtual host that\r
received the request or the error at the beginning of each\r
log line. A simple Perl script can split out the log file\r
after it rotates: one is included with the Apache source\r
- under <code>support/split-logfile\r
- </code>\r
- .\r
+ under <code>support/split-logfile</code>.\r
</p>\r
<p>\r
You can use the <code>BufferedLogs\r
directive to have Apache collect several log lines in\r
memory before writing them to disk. This might yield better\r
performance, but could affect the order in which the\r
- server's log is written. \r
+ server's log is written. \r
</p>\r
\r
\r
</section>\r
</section>\r
- <section id="Generating A Test Load">\r
+ <section id="generating-a-test-load">\r
<title>Generating A Test Load\r
</title>\r
<p>It is useful to generate a test load to monitor system\r
performance under realistic operating circumstances. Besides\r
- commercial packages such as <a href="/httpd/LoadRunner" class="nonexistent">\r
- LoadRunner\r
- </a>\r
+ commercial packages such as <a href="http://learnloadrunner.com/">LoadRunner</a>\r
,there are a number of freely available tools to generate a\r
test load against your web server. \r
</p>\r
</li>\r
<li>\r
<p>ASF external projects, that have proven to be quite\r
- good: grinder, httperf, tsung, <a href="/httpd/FunkLoad" class="nonexistent">\r
- FunkLoad\r
- </a>\r
+ good: grinder, httperf, tsung, <a href="http://funkload.nuxeo.org/">FunkLoad</a>\r
</p>\r
</li>\r
</ul>\r
\r
</section>\r
</section>\r
- <section id="Configuring for Performance">\r
+ <section id="configuring-for-performance">\r
<title>Configuring for Performance\r
</title>\r
\r
\r
- <section id="Apache Configuration">\r
+ <section id="apache-configuration">\r
<title>Apache Configuration\r
</title>\r
<p>The Apache 2.2 httpd is by default a pre-forking web server.\r
MPM runs a smaller number of child processes, and spawns\r
multiple request handling threads within each child process. In\r
2.3+ MPMs are no longer hard-wired. They too can be exchanged\r
- via <a href="/httpd/LoadModule" class="nonexistent">LoadModule\r
- </a>\r
- .The default MPM in 2.3 is the event MPM. \r
+ via <directive module="core">LoadModule</directive>.\r
+ The default MPM in 2.3 is the event MPM. \r
</p>\r
<p>The maximum number of workers, be they pre-forked child\r
processes or threads within a process, is an indication of how\r
a rough estimate because the kernel can queue connection\r
attempts for your web server. When your site becomes busy and\r
the maximum number of workers is running, the machine\r
- doesn't hit a hard limit beyond which clients will be\r
+ doesn't hit a hard limit beyond which clients will be\r
denied access. However, once requests start backing up, system\r
performance is likely to degrade. \r
</p>\r
\r
\r
</section>\r
- <section id="Spinning Threads">\r
+ <section id="spinning-threads">\r
<title>Spinning Threads\r
</title>\r
<p>For the prefork MPM of the above directives are all there is\r
\r
\r
</section>\r
- <section id="Sizing MaxClients">\r
+ <section id="sizing-maxClients">\r
<title>Sizing MaxClients\r
</title>\r
<p>Optimally, the maximum number of processes should be set so\r
<p>The difference between these two is the amount of memory\r
per-process. The shared segment really exists only once and\r
is used for the code and libraries loaded and the dynamic\r
- inter-process tally, or 'scoreboard,' that Apache\r
+ inter-process tally, or 'scoreboard,' that Apache\r
keeps. How much memory each process takes for itself\r
depends heavily on the number and kind of modules you use.\r
The best approach to use in determining this need is to\r
\r
\r
</section>\r
- <section id="Selecting your MPM">\r
+ <section id="selecting-your-mpm">\r
<title>Selecting your MPM\r
</title>\r
<p>The prime reason for selecting a threaded MPM is that\r
\r
\r
</section>\r
- <section id="Spinning Locks">\r
+ <section id="spinning-locks">\r
<title>Spinning Locks\r
</title>\r
<p>Apache httpd maintains an inter-process lock around its\r
network listener. For all practical purposes, this means\r
that only one httpd child process can receive a request at\r
any given time. The other processes are either servicing\r
- requests already received or are 'camping out' on\r
+ requests already received or are 'camping out' on\r
the lock, waiting for the network listener to become\r
available. This process is best visualized as a revolving\r
door, with only one process allowed in the door at any\r
\r
\r
</section>\r
- <section id="The Thundering Herd">\r
+ <section id="the-thundering-herd">\r
<title>The Thundering Herd\r
</title>\r
- <p>The function of the 'accept mutex' (as this\r
+ <p>The function of the 'accept mutex' (as this\r
inter-process lock is called) is to keep request reception\r
moving along in an orderly fashion. If the lock is absent,\r
the server may exhibit the Thundering Herd syndrome. \r
\r
</section>\r
</section>\r
- <section id="Tuning the Operating System">\r
+ <section id="tuning-the-operating-system">\r
<title>Tuning the Operating System\r
</title>\r
- <p>People often look for the 'magic tune-up' that will\r
+ <p>People often look for the 'magic tune-up' that will\r
make their system perform four times as fast by tweaking just\r
one little setting. The truth is, present-day UNIX derivatives\r
are pretty well adjusted straight out of the box and there is\r
</p>\r
\r
\r
- <section id="RAM and Swap Space">\r
+ <section id="ram-and-swap-space">\r
<title>RAM and Swap Space\r
</title>\r
<p>The usual mantra regarding RAM is "more is\r
different ways, it is never a good idea to run with less\r
disk-based swap space than RAM. The virtual memory system\r
is designed to provide a fallback for RAM, but when you\r
- don't have disk space available and run out of\r
+ don't have disk space available and run out of\r
swappable memory, your machine grinds to a halt. This can\r
crash your box, requiring a physical reboot for which your\r
hosting facility may charge you. \r
\r
\r
</section>\r
- <section id="ulimit: Files and Processes">\r
+ <section id="ulimit-files-and-processes">\r
<title>ulimit: Files and Processes\r
</title>\r
<p>Given a machine with plenty of RAM and processor capacity,\r
\r
\r
</section>\r
- <section id="Setting User Limits on System Startup">\r
+ <section id="setting-user-limits-on-system-startup">\r
<title>Setting User Limits on System Startup\r
</title>\r
<p>Under Linux, you can set the ulimit parameters on bootup by\r
<example>session required /lib/security/pam_limits.so\r
</example>\r
\r
- <p>All items can have a 'soft' and a 'hard'\r
+ <p>All items can have a 'soft' and a 'hard'\r
limit: the first is the default setting and the second the\r
maximum value for that item. \r
</p>\r
<p>\r
- In FreeBSD's <code>/etc/login.conf\r
+ In FreeBSD's <code>/etc/login.conf\r
</code>\r
these resources can be limited or extended system wide,\r
analogously to <code>limits.conf\r
</code>\r
- .'Soft' limits can be specified with <code>-cur\r
+ .'Soft' limits can be specified with <code>-cur\r
</code>\r
- and 'hard' limits with <code>-max\r
+ and 'hard' limits with <code>-max\r
</code>\r
.\r
</p>\r
\r
\r
</section>\r
- <section id="Turn Off Unused Services and Modules">\r
+ <section id="turn-off-unused-services-and-modules">\r
<title>Turn Off Unused Services and Modules\r
</title>\r
<p>Many UNIX and Linux distributions come with a slew of\r
</code>\r
directive. \r
</p>\r
- <p>Unused modules may be culled: if you don't rely on\r
+ <p>Unused modules may be culled: if you don't rely on\r
their functionality and configuration directives, you can\r
turn them off by commenting out the corresponding <code>\r
LoadModule\r
lines. Read the documentation on each module’s\r
functionality before deciding whether to keep it enabled.\r
While the performance overhead of an unused module is\r
- small, it's also unnecessary. \r
+ small, it's also unnecessary. \r
</p>\r
\r
\r
</section>\r
</section>\r
</section>\r
- <section id="Caching Content">\r
+ <section id="caching-content">\r
<title>Caching Content\r
</title>\r
<p>Requests for dynamically generated content usually take\r
</p>\r
\r
\r
- <section id="Making Popular Pages Static">\r
+ <section id="making-popular-pages-static">\r
<title>Making Popular Pages Static\r
</title>\r
<p>By pre-rendering the response pages for the most popular queries\r
generated content. For instance, if your application is a\r
flower delivery service, you would probably want to pre-render\r
your catalog pages for red roses during the weeks leading up to\r
- Valentine's Day. When the user searches for red roses,\r
+ Valentine's Day. When the user searches for red roses,\r
they are served the pre-rendered page. Queries for, say, yellow\r
roses will be generated directly from the database. The\r
mod_rewrite module included with Apache is a great tool to\r
</p>\r
\r
\r
- <section id="Example: A Statically Rendered Blog">\r
+ <section id="example-a-statically-rendered-blog">\r
<title>Example: A Statically Rendered Blog\r
</title>\r
<p>\r
- <strong>'we should provide a more useful example here.\r
+ <strong>'we should provide a more useful example here.\r
One showing how to make Wordpress or Drupal suck less.\r
</strong>\r
- ' \r
+ ' \r
</p>\r
<p>Blosxom is a lightweight web log package that runs as a CGI.\r
It is written in Perl and uses plain text files for entry\r
specify blog entries and index pages, so this means that if\r
a particular path under Blosxom exists as a static file in\r
the file system, the file is served instead. Any request\r
- that isn't pre- rendered is served by the CGI. This\r
+ that isn't pre- rendered is served by the CGI. This\r
means that individual entries, which show the comments, are\r
always served by the CGI which in turn means that your\r
comment spam is always visible. This configuration also\r
\r
</section>\r
</section>\r
- <section id="Caching Content With mod_cache">\r
+ <section id="caching-content-with-mod_cache">\r
<title>Caching Content With mod_cache\r
</title>\r
<p>The mod_cache module provides intelligent caching of HTTP\r
the cache. The provider module for mod_cache, mod_disk_cache,\r
determines how the cached content is stored on disk. Most\r
server systems will have more disk available than memory, and\r
- it's good to note that some operating system kernels cache\r
+ it's good to note that some operating system kernels cache\r
frequently accessed disk content transparently in memory, so\r
replicating this in the server is not very useful. \r
</p>\r
</p>\r
\r
\r
- <section id="Example: wiki.apache.org">\r
+ <section id="example-wiki">\r
<title>Example: wiki.apache.org\r
</title>\r
<p>\r
- <strong>'Is this still the case? Maybe we should give\r
+ <strong>'Is this still the case? Maybe we should give\r
a better example here too.\r
</strong>\r
</p>\r
<p>\r
- The Apache Software Foundation Wiki is served by <a href="/httpd/MoinMoin">\r
- MoinMoin\r
- </a>\r
- .<a href="/httpd/MoinMoin">MoinMoin\r
- </a>\r
- is written in Python and runs as a CGI. To date, any\r
+ The Apache Software Foundation Wiki is served by MoinMoin.\r
+ MoinMoin is written in Python and runs as a CGI. To date, any\r
attempts to run it under mod_python has been unsuccessful.\r
The CGI proved to place an untenably high load on the\r
server machine, especially when the Wiki was being indexed\r
</section>\r
</section>\r
</section>\r
- <section id="Further Considerations">\r
+ <section id="further-considerations">\r
<title>Further Considerations\r
</title>\r
<p>Armed with the knowledge of how to tune a sytem to deliver the\r