I've run into a problem and I just can't seem to figure out how to solve it; I have a regular Ubuntu 12.04 Server with apache 2.2 running a website. Every now and then the server overloads and starts becoming unresponsive, simple commands takes ages to execute until the server is restart or apache/mysql is restarted. (And the website itself shuts down complety)
Looking in the error log I see a simple
[error] server reached MaxClients setting, consider raising the MaxClients setting
Followed by a bunch of mysqli being unable to connect
One would simply assume that I would need to increase the MaxClients but I've already done this a couple of times and I worry that I will overload the server myself by setting it too high, below is how the mpm prefork is currently set:
<IfModule mpm_prefork_module> StartServers 20 MinSpareServers 10 MaxSpareServers 20 MaxClients 150 MaxRequestsPerChild 90 </IfModule>
On a normal day we have roughly 1700 Users/Visitors (During 24 hours).
- Memory: 3GB
- CPU: 1 - 3300MHz
- OS: Ubuntu 12.04
- Apache: 2.2 with php 5.3.10 & Mysql 5.5.41
Couple of pictures I got with glances, here you can see apache swallowing quiet a lot of CPU before they drop down again: (This is with only a coupe of users on the webserver (5 to 20) )
How do I avoid my server crashing / overloading? ( I am open to any solution, even changing to nginx or something else if that could handle the load better).
Also, I'm not concerned about RAM usage / consumption since I can add a lot more RAM, it's the CPU I'm concerned about.