Insights into high capacity Apache / keep alives
I have a Linode 1536 serving some web applications. I am fairly pleased with how many hits it can serve (dynamic PHP/MySQL/Apache). I'm looking for some insights on how people increase capacity, in particular how do you manage to use keep-alives without filling up every slot very very quickly. To date I've never had keep-alives turned on for production instances because of this.
Thanks.
9 Replies
@jonny5alive:
Hi
I have a Linode 1536 serving some web applications. I am fairly pleased with how many hits it can serve (dynamic PHP/MySQL/Apache). I'm looking for some insights on how people increase capacity, in particular how do you manage to use keep-alives without filling up every slot very very quickly. To date I've never had keep-alives turned on for production instances because of this.
Thanks.
You can run a light weight web server like nginx in front of apache that has keepalives on, it will serve static files itself, and pass php requests off to apache which doesn't have keepalives. There's a number of ways this should increase the number of users you can serve. 1) apache talks to nginx via localhost, so the 3 way handshake and data transfer will be lightning quick, 2) static files are no longer handled by apache which probably has mod_php loaded, which uses a lot of memory.
There's lots of other ways to reduce load, tuning mysql so it handles queries faster, apc for php, probably a 100 other things I don't know of.
Oh, and do some benchmarks with web server load testing software before and after changes so you can see you're going in the right direction.
It isn't necessarily any faster, though. It'll run at the same speed. The big difference is that you can handle the same load with a lot less memory.