ClickAider
You are currently browsing the Bogle’s Blog weblog archives for the day Thursday, October 5th, 2006.

Optimizing Apache for Low Memory Usage

Hosting providers like Serverpronto offer amazingly good deals on dedicated servers but the tradeoff is that at $30/month, you only get 256MB of RAM with your server.

With so little memory, the default Apache memory configuration in the Redhat distribution will enter a flaming death spiral of swapping under moderate load.  If you’re in that boat, you should read Optimizing MySQL and Apache for Low Memory Usage by Emergent Properties. 

There are a number of tips, but the most valuable one in my experience was the simplest.  Reduce the default keep-alive timeout from 15 seconds to 2 seconds.  2 seconds is long enough to ensure that a page and all of its resources are fetched in a single TCP connection, but greatly reduces the need to create new Apache workers or queue requests because existing workers are tied up waiting for the keepalive timeout.