A number of network-related Apache settings can degrade performance. The following sections discuss some of the most relevant. HostnameLookupsHostnameLookups off When HostnameLookups is set to on or double, Apache will perform a DNS lookup to capture the hostname of the client, introducing a delay in the response to the client. The default setting is HostnameLookups off. If you need to use the hostnames, you can always process the request logs with a log resolver later, as explained in Chapter 3. Certain other settings can trigger a DNS lookup, even if HostnameLookups is set to off, such as when a hostname is used in Allow or Deny rules, as covered in Chapter 6. Request Accept MechanismApache can use different mechanisms to control how Apache children arbitrate requests. The optimal mechanism depends on the specific platform and number of processors. Additional information can be found at http://httpd.apache.org/docs/2.0/misc/perf-tuning.html. mod_statusThis module collects statistics about the server, connections, and requests. Although this can be useful to troubleshoot Apache, it can also slow down the server. For optimal performance, disable this module, or at least make sure that ExtendedStatus is set to off, which is the default. AcceptFilterAcceptFilter http data AcceptFilter https data A number of operating systems, such as Linux and FreeBSD, allow you to mark certain listening sockets as handling specific protocols. Thus, it is possible to ask the kernel to only pass a request to Apache once all the content of the HTTP request has been received, improving performance. This capability is only implemented in Apache 2.1 and later, although there is an earlier, BSD-specific version of the AcceptFilter directive present in Apache 1.3.22 and later. You can find more in-depth documentation for socket configuration in the AcceptFilter manual page. KeepAlivesKeepAlive On KeepAliveTimeout 5 MaxKeepAliveRequests 500 HTTP 1.1 allows multiple requests to be served over a single connection. HTTP 1.0 allows the same thing with keep-alive extensions. The KeepAliveTimeout directive enables you to specify the maximum time in seconds that the server will wait before closing an inactive connection. Increasing the timeout means that you will increase the chance of the connection being reused. On the other hand, it also ties up the connection and Apache process during the waiting time, which can prevent scalability, as discussed earlier. The MaxKeepAliveRequest directive allows you to specify the maximum amount of times the connection will be reused. |