Performance Tuning Directives
The KeepAlive directive enables or disables the use of persistent connections. Without a persistent connection, the client must make a new connection to the server for every link the client wants to explore. Because HTTP runs over TCP, every connection requires a connection setup. This adds time to every file retrieval. With a persistent connection, the server waits to see if the client has additional requests before it closes the connection. Therefore, the client does not need to create a new connection to request a new document. The KeepAliveTimeout defines the number of seconds the server holds a persistent connection open, waiting to see if the client has additional requests.
MaxKeepAliveRequests defines the maximum number of requests that will be accepted on a "kept-alive" connection before a new TCP connection is required. The Apache default value is 100. Setting MaxKeepAliveRequests to 0 allows unlimited requests. 100 is a good value for this parameter. Few users request 100 document transfers, so the value essentially creates a persistent connection for all reasonable cases. Additionally, if the client does request more than 100 document transfers, it might indicate a problem with the client system. At that point, requiring another connection request is probably a good idea.
Timeout defines the number of seconds the server waits for a transfer to complete. The value needs to be large enough to handle the size of the files your site sends and the low performance of the modem connections of your clients. But if it is set too high, the server will hold open connections for clients that may have gone offline. The Red Hat configuration has this set to five minutes (300 seconds).
BrowserMatch is a different type of tuning parameter: It reduces performance for compatibility's sake. The Red Hat configuration contains the following five BrowserMatch directives:
BrowserMatch "Mozilla/2" nokeepalive BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0 BrowserMatch "RealPlayer 4\.0" force-response-1.0 BrowserMatch "Java/1\.0" force-response-1.0 BrowserMatch "JDK/1\.0" force-response-1.0
The BrowserMatch directives present information in a manner that is compatible with the capabilities of different web browsers. For example, a browser may be able to handle only HTTP 1.0, not HTTP 1.1. In this case, downgrade-1.0 is used on the BrowserMatch line to ensure that the server uses only HTTP 1.0 when dealing with that browser. In the Red Hat configuration, keepalives are disabled for two browsers. One browser is offered only HTTP 1.0 during the connection. And responses are formatted to be compatible with HTTP 1.0 for four different browsers.
Don't fiddle with the BrowserMatch directives. These settings are shipped as defaults in the Apache distribution. They are already set to handle the limitations of different browsers. These are tuning parameters, but they are used by the Apache developers to adjust to the limitation of older browsers.
In this tutorial:
- Apache Web Server
- Installing Apache
- Running httpd
- Configuring the Apache Server
- The httpd.conf File
- Loading Dynamic Shared Objects
- Basic Server Directives
- Multi-Homed Server Configuration
- Defining Where Things Are Stored
- Creating a Fancy Index
- Defining File Types
- Managing Child Processes
- Performance Tuning Directives
- Caching Directives
- Defining Virtual Hosts
- Web Server Security
- The CGI and SSI Threat
- Server Options for Documents and Directories
- Directory-Level Configuration Controls
- Defining Access Controls
- Requiring User Authentication
- High-Performance User Authentication
- Configuring SSL
- Managing Your Web Server
- Monitoring Your Server
- Apache Logging
- Defining Log Formats
- Using Conditional Logging