apache KeepAlive latency problem
Hello, I've been searching and reading about KeepAlive and a latency problem that I'm seeing on a box with apache 2.0.From my tests, the smaller the KeepAliveTimeout value I use, the better performance I get (lower latency time). I'm measuring latency time with echoping on the local loopback.
This is a box with high-traffic and plenty of pages with 20 pictures or more on each page. So it's important to me that I find a setting which allows for low latency while still economizing system resources.
I'm using prefork model and these are the current settings:
<IfModule prefork.c>
StartServers 28
MinSpareServers 50
MaxSpareServers 100
MaxClients 256
ServerLimit 256
MaxRequestsPerChild 2000
</IfModule>
Here are some KA values I used, and the result:
KeepAliveTimeout 15 - results in high latency (8-15 seconds)
KeepAliveTimeout 5 - results in average latency (1-4 seconds)
KeepAlive Off - results in very low latency (<1 sec)
The other system variables are fine, CPU load is less than 10% average, memory/swap is fine.
My question is twofold. Why should KeepAlive cause such high latency when used with default value, and if this is the case, what will be the risk of running without KeepAlive?
I'm currently using KeepAlive with a low value for timeout, hoping that the latency cost is worth something.
The websites are running HTML only, very little PHP/mySQL usage otherwise (less than 1% of the traffic). The traffic is currently about 1.5 Mb/s.
Thanks for any thoughts you might have about this.