Bobcares

DigitalOcean high CPU usage – How we identify and fix it

by | Mar 31, 2020

DigitalOcean high CPU usage can be a nightmare for Droplet owners.

Usually, high CPU usage happens due to faulty processes, wrong configuration or even a lack of server resources.

The real challenge lies in finding the exact process that makes the CPU usage high.

At Bobcares, we help our customers in managing Droplets as part of DigitalOcean Managed Services.

Today, let’s take a look at how we identify the real reason for the DigitalOcean high CPU usage and fix it.

 

Impact of high CPU usage in DigitalOcean

Are you curious to know the downside of high CPU usage on a DigitalOcean Droplet?

Just like any other server, when the CPU usage goes high, the server and even the websites become slow. It takes too much time to complete a process.

Due to this delay in execution, the processes keep on queuing. This further adds to the server load. Ultimately, it can even result in a server crash.

That’s why most DigitalOcean customers set up realtime monitoring of server resources. This triggers an email alert when CPU usage goes beyond a particular limit.

A similar notification email on one of our customer’s Droplet turned up as:

DigitalOcean high CPU usage

 

 

Common causes for DigitalOcean high CPU usage

From our expertise in managing DigitalOcean Droplets, we often deal with resource usage problems. Let’s now check the common reasons that cause high CPU usage in Droplets.

 

1. Incorrect service configuration

Quite often, the CPU usage problems crop up due to errors in the service configuration. Usually, it will be badly configured MySQL service, Java processes, etc.

Due to the unoptimized queries to databases, each process creates a big impact on the CPU. When there are multiple processes of the same service, it can lead to high CPU usage.

 

2. Insufficient server resources

Similarly, insufficient resources on the Droplet can also trigger high CPU usage.

For instance, imaging a user trying to run a CPU intensive application on a $10 Droplet. Initially, the app will work fine when the number of users are less. Thereafter, when the app users go high, it starts using more CPU.

Thus, the resource allocation should always be proportional to the expected usage.

 

3. Poorly configured applications

Many times, some applications may also increase CPU usage. This mainly happens when applications trigger resource-intensive processes. This can be a backup or restore process, updating files, etc.

Here, the best way to properly test the application before making it live.

 

How we fix DigitalOcean high CPU usage

Till now we saw the various reasons for the high CPU usage in Droplets. We’ll see how we fixed the problem for one of our customers.

He was getting alert emails about CPU usage hitting the limits every day. There was a spike in the server load. Sometime later it became alright again.

We logged in to the Droplet via SSH and checked the server load. Then we issued the command:

top -c

We found that the server load was due to a wp-cron process under a WordPress website. The process table appeared as per the snippet below:

DigitalOcean_high_CPU_Usage_top_results

The server had too many wp_cron processes running for a long period of time. It was consuming %CPU of 42.2, 35.3, etc. This was overloading the server.

Further, we checked the processing power of the DigitalOcean Droplet using the command,

nproc

This command displays the number of processing units available.

From the results, we inferred that the server had enough processing power. Therefore, we intimated the details to the customer.

Later, we changed the frequency of the WordPress cron to fix the high CPU usage. Also, we scheduled the task to run at an off-peak time of the server.

This fixed the CPU usage problem of the Droplet.

In some cases, when the Droplet resources are insufficient, we suggest customers upgrade to the next higher package too.

[Struggling to find out the exact process behind the high CPU usage on the server? Get help from the experts!]

 

Conclusion

In short, the DigitalOcean high CPU usage occurs due to faulty service configuration, lack of server resources, etc. Today, we saw how our DO Experts identify the exact process that uses the CPU processing power and fix it.

PREVENT YOUR DROPLET FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our DigitalOcean experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

2 Comments

  1. Roberto Di Liberto

    Hi everybody, my question:
    I had a few times the “high CPU usage” on my droplet.
    I like to know if I can see which process was causing the “high CPU usage” in some logs or whatever. When I’ve got the mail I was working so not possible to go online.
    I hope you can help me.
    Thank in advance.
    Roberto

    Reply
  2. Maheen Aboobakkar

    Hello Roberto,

    You can use top -c command to find the process causing high CPU usage. We’ll be happy to talk to you on chat (click on the icon at right-bottom).

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.