I'm trying to solve this issue on my company high traffic sport website: on particular sport events a lot of people open the website at the same time, causing a big requests spike. Five Apache load balanced are configured with mpm_worker:
ServerLimit 150
ThreadLimit 100
StartServers 25
MaxClients 10000
MinSpareThreads 250
MaxSpareThreads 2500
ThreadsPerChild 80
MaxRequestsPerChild 10000
On traffic spikes, the server stop to respond, lots of connections get a timeout, create some child processes then start again to respond. All five servers do the same, so the website will be unavailable for a minute or two on traffic spikes. This is obviously unacceptable by our management... so I'm trying to figure out what the problem can be.
System load, memory, fork rates, cpu wait... everything seems ok. I think the problem is: apache receive a lot o requests, assigns to threads, when idle threads < MinSpareThreads starts creating children and for some reasons stop responding to new connections (even if there are idle servers).
I tried to reduce MinSpareThreads but apache reduces the number of idle processes to just MinSpareThreads, so the effect on traffic spikes is even worse. If I increase MinSpareThreads I have a lot o idle threads ready to respond but the damn apache starts creating thread on traffic spikes to preserve the MinSpareThreads quota and stops to respond.
How can I handle this? There's a way to tell apache to let alive a number of threads between MinSpareThreads and MaxSpareThreads?