Unfortunately we had to move to using KeepAlive after a series of ddos attacks on our server. I run a web game so pages are generally small and largely text, so having KeepAlive off worked well for many years. Things didn't seem much different (apart from being able to handle the ddos attacks better) after some quick configuration changes and server load stays fairly low at on average about 0.50 with memory usage on about 10% (24GB total).
About once a day however apache just hangs and won't respond for about 15 minutes. Even throughout the day, sometimes pages take 5 seconds to load and I notice in the apache status the only thing on the scoreboard are keepalive (read) requests, no waiting for connection, reading reply, closing connection etc, just about 100+ read requests. Then it sorts itself out. It just seems random when this happens, although it is normally during a busy time of the day neither the server load nor the memory is high nor is apache running out of available request slots.
My configuration changes are as follows:
ServerLimit 1024
MaxClients 1024
Timeout 2
KeepAliveTimeout 5
KeepAlive On
MaxKeepAliveRequests 100
MinSpareServers 100
MaxSpareServers 200
I hope someone has some insight into this or can suggest what logs / processes I can check to see why this is happening.
Thanks in advance.
EDIT: Incase this helps…
56 requests/sec - 116.2 kB/second - 2126 B/request
105 requests currently being processed, 154 idle workers
Later in the day I'd expect double that.
EDIT 2: KeepAliveTimeout changed from 5 to 2
EDIT 3: It just happened again. This time I was around to see it. Apache was unresponsive and wasn't taking up any memory. There were 250 connections from 127.0.0.1 and that never happens. After an Apache restart all was fine. Very odd!
Best Answer
A few things you can do or check: