My server keeps going of for every five days. but my CPU useage is less How can i solve it

Posted December 6, 2016 1.6k views

I have installed 20 wordpress websites in one droplet. But cpu useage does not exeed 10%. Some times my servers are hanged and it shows error establishing database connection. How can i solve it.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

It could be to not enough RAM available. If your service ran out of memory, it’ll get killed and you can have problem like above.

You can look for logs. Start with syslog:

  • nano /var/log/syslog

Look there for entries like OOM, OOM killer, proccess killed, out of memory. If you find that logs, it means that you don’t have enough RAM.

If you can’t find logs there, you can also look for alternative location /var/log/messages.

In case this is the problem upgrading Droplet or installing Swap would do the job.
How To Add Swap on CentOS 7 or for CentOS 6 How To Add Swap on CentOS 6.

by Etel Sverdlov
Linux swaps allow a system to harness more memory than was originally physically available. Here's how to set up a linux swap file on CentOS 6

I had the same issue a while back, and yes, it was the RAM running out taking down MySQL with it. Increasing the RAM size and adding swap fixed that for me. Swap though degrades SSD drives so opt for an increase in RAM if you have the budget for it but swap will do if you’re tight on cash.

Back then, I used New Relic to monitor my servers that helped me identify the issue. You might want to look into monitoring tools to help you manage yours as well.