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

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.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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.

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:

  1. 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.