Question

Much higher CPU load than usage on database

My managed Postgre database is showing a lot higher average load compared to CPU usage. How should I interpret this? (The cluster has 2 vCPU.)

Insights
image caption

As far as I understand, a CPU load of 2 would be 100% usage with 2vCPUs. I don’t understand why it’s maintaining 4-5 load with only 60-80% usage. (The load is not primarily from a single connection, btw, it’s spread over 6-10.)

If I go by load, my cluster seems way overloaded. But if I go by CPU usage, it seems healthy and fine.


Submit an answer


This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
September 3, 2024

Hey Adam,

The CPU Usage shows how much of the CPU’s capacity is being used.

And the Load Average on the other side, shows the number of processes waiting to run or running.

Even if your CPU usage is only 60-80%, the load average can still be high if there are a lot of processes waiting in line. This usually happens when your system is doing lots of disk I/O (like reading/writing to the disk), waiting for resources, or running many queries at the same time.

Since your cluster has 2 vCPUs, a load average of 2 would mean the CPUs are fully utilized. But since your load average is 4-5, it means there are more processes waiting to be handled by the CPU. This is why it seems overloaded by load average but looks fine on CPU usage.

You might want to check disk I/O and see if there are any slow queries or heavy operations that could be causing this.

You might also want to check out these guides here:

https://www.digitalocean.com/community/tutorials/how-to-analyze-managed-postgresql-database-statistics-using-the-elastic-stack-on-ubuntu-18-04

https://docs.digitalocean.com/products/databases/postgresql/how-to/monitor-databases/

Hope this clears things up!

- Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
Animation showing a Droplet being created in the DigitalOcean Cloud console