Server Running out of memory


I’ve been thrown in the deep end at work, as I’m now managing the server. Why me?? Its a dedicated server we control through CP+ using LAMP, hosted by another provider.

One of the most pressing issues to me is reducing the number of crashes due to server running out of memory. The average memory load is about 25%, so it appears the crashes are spikes caused by bad script programming. Trouble is, we have so many sites the process of going through each an every site would take years!

When it comes to managing a server, I’m a novice, so the question I’m really trying to ask is where’s the best place to start. Does anyone have any advice in terms of must-have processes/software to run for monitoring, etc. Are there any safeguards you would suggest to prevent server from stalling.

I realise this is a broad question; considering that’s the task in front of me anything will help as a starting point.

Thanks in advance.


You should check o/p of top command. It will show you the memory consuming applications. I suspect, it should be either mysql or php pages that are consuming your resources. I would suggest you to optimize your mysql and apache that would really help you to utilize server resources preperly. If you are not sure how to do this, you can hire any server management company.


Thanks for your reply Hostwaresupport,

MySQL is the biggest memory consuming application running, according to the process list, with Python second.

It turns out the culprit was a website creating persistent database connections, but the timeout SQL variables were ridiculously high, so server had no way to flush finished connections before memory ran out. I’ve never been a fan of these types of connections, so they’ve been removed, and timeouts have been reduced. Memory is now at a manageable level.

Thanks again

Yeah, I am agree with you. Mysql is also high resources consuming application on server if it is not configured properly. The best way is that to optimize it.


if you have root access login to SSH and check

mysql processlist on root this command will show you which the database thats using the max no. of process.

Thats the reason its always better to go for a web hosting company that offers fully managed servers.

Such issue disturb you from keeping your attention on growing business and keeps you stuck to such problems.

I would check to see if your code has a leak or loop in it which is causing mysql to eat up all the ram. I have seen that many times!