KeepAlive is a feature that make the server keep each listening connection alive for a certain amount of time, allowing a client and the server to keep the same connection for a certain amount of time. This feature has benefits and drawbacks.
A benefit would be that a client making more than one request won’t have to re-initiate a new connection for each request.
A drawback will be that ressources on the server are monopolize for a predefined time, even though the client might not request other pages.
By default, on Debian and Ubuntu, KeepAlive is set to On and the KeepAliveTimeout to 15, so if you get 256 different connections per seconds during 15 seconds, you could (theorically) have to allocate memory for 3840 connections :s .
There is 2 options in order to handle this:
- Disable KeepAlive connections (by setting KeepAlive to Off)
- Shorten the KeepAliveTimeout value to something like 3 seconds for instances), reducing the maximum simultaneous opened connections to 768
Compress HTTP Content
If you are running out of bandwidth, it could be worth using mod deflate.
Mod deflate is an Apache module compressing HTTP content on the fly.
Because data will be compressed, your bandwidth will be saved, but as a drawback, you will need more CPU resources per request.