I thought MaxClients is just a limit and when the server hits the limit, it shows blank pages for some people preventing the overload. Also I thought it's just a limit, so the spare connections aren't used unless they are needed and they are freed after that. But my server machine seems to deny all this.
Several months ago there where repeatedly "consider rising MaxClient" line in Apache's log of my server machine. Before I realized what's happening, server pile up the CPU load and then the machine crashed completely. That happens like 3 times in about a week before I rise up the MaxClient value from 500 to 900 (MPM prefork).
[Last crash*] Long after, 2 weeks ago, there were a connection peak caused by real visits (we published some "exlusive" info). It probably hits the 900 limit (it showed up once at log), server start to lag and in matter of minutes it crashed again. That end with 2 hours blackout (filesystem has got corrupted).
So now I have MaxClient = 2000 but the problem I have had, appeared days before the [Last crash*]. So I actually don't know if it is relevant.
These are my symptoms:
- random CPU load increase (up to like 12, usual load under 5) until restarting Apache, after restart load drops down rapidly
- after restart it tooks from hours to days before it shows up again
- this load increase seems to add like "5" to existing load, meaning, in the morning it's approx. 2+5 and if I won't restart Apache it goes higher with real visits (12-14 at peak)
- when it hits the peak, it won't go down, it stay there until restart no matter day time or actual visits
- it seems the load issues start at random times, peaks, night, morning, Monday, Saturday doesn't matter
- this load doesn't seem to affect performance at all (but I don't like it, if nothing else, it is shortening the CPU lifetime)
- the load is caused by Apache for sure (top, htop checks that)
This is my MPM prefork setting (24GB RAM, Apache + MySQL + data):
StartServers 5
MinSpareServers 5
MaxSpareServers 10
ServerLimit 2000
MaxClients 2000
MaxRequestsPerChild 0
Also I have KeepAlive off. Could that could play some role at this behaviour?
KeepAlive Off
MaxKeepAliveRequests 0
KeepAliveTimeout 2
From server status: 40 requests currently being processed, 0 (or up to like 12) idle workers now. It's saturday night tho. Now I'm getting really similar numbers but it's sunny Sunday noon... damn it xD
First I thought it's faulty php script but I'm not sure about anything now. No one seems to change any script when the problem showed up first time. And the weird crashing behaviour when hitting the limit tells me, there could be wrong something entirely else (especially when the rising value helps, it doesn't look like memory lack).
I'm sorry for the exhausting description. I don't usually ask before search but I seriously ran out of ideas today. I can't keep restarting all the time. These 2 seconds doesn't matter but there is also the chance some major script couldn't finish it's job properly or editor lost his work when hitting the save button at the wrong moment.
So, to keep it simple, I would like your opinion on my Apache's setting as well if it's even possible that this could have some relevance with my load issues.