To set keep=alive parameters in Apache2 Httpd, you need to pay attention to 3 directives:
The Keep-Alive extension to HTTP/1.0 and the persistent connection feature of HTTP/1.1 provide long-lived HTTP sessions which allow multiple requests to be sent over the same TCP connection. In some cases this has been shown to result in an almost 50% speedup in latency times for HTML documents with many images. To enable Keep-Alive connections, set
The number of seconds Apache will wait for a subsequent request before closing the connection. Once a request has been received, the timeout value specified by the
The
KeepAlive
KeepAliveTimeout
MaxKeepAliveRequests
KeepAlive Directive
Description: | Enables HTTP persistent connections |
---|---|
Syntax: | KeepAlive On|Off |
Default: | KeepAlive On |
Context: | server config, virtual host |
Status: | Core |
Module: | core |
The Keep-Alive extension to HTTP/1.0 and the persistent connection feature of HTTP/1.1 provide long-lived HTTP sessions which allow multiple requests to be sent over the same TCP connection. In some cases this has been shown to result in an almost 50% speedup in latency times for HTML documents with many images. To enable Keep-Alive connections, set
KeepAlive On
.
For HTTP/1.0 clients, Keep-Alive connections will only be used if they are specifically requested by a client. In addition, a Keep-Alive connection with an HTTP/1.0 client can only be used when the length of the content is known in advance. This implies that dynamic content such as CGI output, SSI pages, and server-generated directory listings will generally not use Keep-Alive connections to HTTP/1.0 clients. For HTTP/1.1 clients, persistent connections are the default unless otherwise specified. If the client requests it, chunked encoding will be used in order to send content of unknown length over persistent connections.
When a client uses a Keep-Alive connection it will be counted as a single "request" for the MaxRequestsPerChild directive, regardless of how many requests are sent using the connection.
KeepAliveTimeout Directive
Description: | Amount of time the server will wait for subsequent requests on a persistent connection |
---|---|
Syntax: | KeepAliveTimeout seconds |
Default: | KeepAliveTimeout 5 |
Context: | server config, virtual host |
Status: | Core |
Module: | core |
The number of seconds Apache will wait for a subsequent request before closing the connection. Once a request has been received, the timeout value specified by the
Timeout
directive applies.
Setting
KeepAliveTimeout
to a high value may cause performance problems in heavily loaded servers. The higher the timeout, the more server processes will be kept occupied waiting on connections with idle clients.
In a name-based virtual host context, the value of the first defined virtual host (the default host) in a set of
NameVirtualHost
will be used. The other values will be ignored.MaxKeepAliveRequests Directive
Description: | Number of requests allowed on a persistent connection |
---|---|
Syntax: | MaxKeepAliveRequests number |
Default: | MaxKeepAliveRequests 100 |
Context: | server config, virtual host |
Status: | Core |
Module: | core |
The
MaxKeepAliveRequests
directive limits the number of requests allowed per connection whenKeepAlive
is on. If it is set to 0
, unlimited requests will be allowed. We recommend that this setting be kept to a high value for maximum server performance.
For example:
No comments:
Post a Comment