On 8/19/2009 1:49 PM, William Attwood wrote:
> I ran across KeepAlive, and enabled it. I then did more `ab` testing
> with -k to take advantage of the change. I am now able, on the same server,
> to handle 1,000 concurrent HTTPS requests, 100,000 total requests, and do it
> all in under 50ms per request.
>
> # KeepAlive: Whether or not to allow persistent connections (more than
> # one request per connection). Set to "Off" to deactivate.
> #
> KeepAlive On
Hello,
New connections are relatively expensive, especially when you are
requesting very small items like html, css, or javascript files.
KeepAlive makes it so multiple items can be requested in one single
connection. This setting is also affected by the "MaxKeepAliveRequests
100" setting. This would mean, for example:
Example 50 "items" (under the 100 max per connection) on a page to be
requested:
* With KeepAlive On this equates to 1 new expensive connection being
created.
* With KeepAlive Off this equates to 50 new expensive connections
being created.
This becomes more obvious with your example of 1,000 concurrent connections:
* With KeepAlive On this equates to 1,000 new connections being created.
* With KeepAlive Off this equates to 1,000 x 50 "items" = 50,000 new
connections being created.
Summary: 50,000 connections verses 1,000 connections overhead just to
pass the same data through.
The overhead is due because when building a "new" connection there is a
lot of hurdles to pass:
* Creating a TCP/IP socket
* Firewall rules are generally always about "new" connections so
this is a delay point
* Apache has to receive the socket request
* Apache then has to assign a worker to perform the request
All of this is avoided for the multiple items on a single KeepAlive request.
So if this has such a benefit why is it disabled by default? Good
question. Almost every "performance tuning" apache documentation I have
seen indicates this as the first item to turn on. Maybe it is simply a
paranoid design decision, as a connection that can be forced to stay
open for a longer time period consumes more resources. You may be able
to now push more traffic through, but the system now more open to be
overloaded with.
Kenneth
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/