Hi, i need help. My droplet’s CPU usage sometimes go above 90% and stay like that. This make my website timeout. Is there any way to set auto reboot droplet when CPU usage go above 90%?

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.

×
1 answer

Hi @mazelanrahman,

You can write a script to check for your load and reboot your droplet however I wouldn’t recommend it. If your CPU gets higher than 90 % it means two things, you either need to upgrade or something is not correctly set and it’s causing you this load.

Let’s start with the second assumption.

What is causing this load

I see you are using Apache. Usually when the website just hands and loads endlessly it means your Apache Workers are full. Apache Workers are like slots each user on your website can take. For instance if you have 200 Apache Workers, there can be up to 200 visitors at the same time. When they get full, every request after them just hangs on a white page until a slot has been freed.

There could be two reasons behind this behavior.

  1. You have a lot of trafic to your website
  2. You are being targeted by bots which take all of your available workers.

You can confirm this theory when you experience the issues. You can check how much IPs are connected to your droplet and see from which countries they are. Usually if your website is suppose to have UK visitors, having IPs from China or Russia means they are not legitimate and you can block them. If this doesn’t solve your problem, you’ll need to turn yourself to see if something else is causing this issue like RAM being full by a service you are running of some sorts.

Alternatively, if the traffic is only from expected countries and it’s legitimate, you might need to increase your Apache Workers limit. This can be done from your Apache configuration file. Once you’ve changed your limit, just restart Apache.

Please note increasing the limit may again require you to upgrade your droplet which brings us to the next solution.

Upgrade

As mentioned already, either way you might need to Upgrade your droplet. It’s possible your website/application just got too popular and it outgrowed your droplet.

Regards,
KDSys

Submit an Answer