Server Crashing from OOM errors

jenkinsp

Registered
Jan 26, 2013
2
0
1
cPanel Access Level
Root Administrator
I'm wondering if anyone else has had this issue and if there are any easy ways to correct or impose restrictions so it stops happening.

I run a small hosting server, with about 8 websites on, and not a massive amount of resources, but there is not a massive amount of load or demand. I've moved from a vps with LCN.com running Plesk to Rackspace cloud server running cPanel, same specification. No server issues with LCN just poor support from my experience. Since moving to Rackspace using cPanel. The support has been better, but I've had the server crash with out of memory errors every other week. This is odd to me as the demand for the websites hasn't changed and the specification was the same, since then I've upgraded to twice the spec, twice the cost, and now it doesn't happen as much but at least twice a month and usually goes down when I'm not around so everything is down for half a day or so. Before moving it back to lcn/plesk I thought I'd post on here to see if anyone can help or see if I'm doing something wrong.

Generally the server tends to be around 30% used in memory and disk. Looking through the daily log its evident that when it had last crashed a magento index.php on one of the accounts is using 99% of the memory. On other occasions it has been other php scripts that were poorly written which have been corrected as well as magento index.php.

The php memory_limit is set to 64M.

The main issue is when this happens the server becomes non-responsive and when trying to connect, web or ssh, it times out. Apache log errors include:

Lots of [Sat Jan 26 06:13:56 2013] [error] [client 157.55.36.54] Script timed out before returning headers: index.php

The odd [Sat Jan 26 06:12:57 2013] [error] server reached MaxClients setting, consider raising the MaxClients setting

Are there any methods used within WHM/cPanel to stop this happening? (not too interested in getting a better cloud server, this one currently uses 30% resources, and worked fine with plesk/lcn with same website loads)

Is there not a way to restrict the memory of PHP to stop this happening? Or restrict the resources per account, so it one account has a memory issue, it will not affect the whole server becoming unresponsive?
 

dalem

Well-Known Member
PartnerNOC
Oct 24, 2003
2,983
159
368
SLC
cPanel Access Level
DataCenter Provider
short off adding more ram
optimize mysql
optimize Apache
adding php accelerators
Set up caching for your scripts
shutting down any services your not using

cpanel uses more ram out of the box than plesk