How To Understand Ubuntu CPU Load

It’s really important to know what your Ubuntu CPU load averages mean. The three numbers represent an average over progressively longer periods of time (one, five, and fifteen-minute averages), and the lower the number, the better. The higher the number, the more overloaded your machine is. But what’s an acceptable range? When should you be concerned?


Lets Access The Ubuntu Server’s Processes

In this tutorial we will use the top command on Ubuntu. This is used to show the Linux processes. It provides a dynamic real-time view of the running system. Usually, this command shows the summary information of the system and the list of processes or threads which are currently managed by the Linux Kernel.

As soon as you will run this command it will open an interactive command mode where the top half portion will contain the statistics of processes and resource usage. And Lower half contains a list of the currently running processes. Pressing q will simply exit the command mode.

First we will focus on the analogy of a 1 core CPU which is the easiest to explain.

A single-core CPU is like a single lane of traffic. If a bridge operator wants to know how traffic is moving, a reasonable metric would be the number of cars waiting at any given time. For example, if no cars are waiting, drivers will know they can drive across right away. If cars are backed up, there will be wait time to before they can pass through.

  • 0.00 means there’s no traffic on the bridge at all. In fact, between 0.00 and 1.00 means there’s no backup, and an arriving car will just go right on.
  • 1.00 means the bridge is exactly at capacity. All is still good, but if traffic gets a little heavier, things are going to slow down.
  • over 1.00 means there’s backup. How much? Well, 2.00 means that there are two lanes worth of cars total — one lane’s worth on the bridge, and one lane’s worth waiting. 3.00 means there are three lanes worth total — one lane’s worth on the bridge, and two lanes’ worth waiting. Etc.

When to look into an issue?

The CPU is basically a bridge. Cars (processes) are either in motion, crossing the bridge, or they’re queued up waiting to cross the bridge. Linux refers to this as the run-queue length: the sum of the number of processes that are currently running plus the number that are waiting (queued) to run.

Like a bridge operator, you want your cars/processes to never be waiting. So, your CPU load should ideally stay below 1.00. However, you’re still OK if you get some temporary spikes above 1.00 … but when you’re always above 1.00, you should worry.

The problem with a load of 1.00 is that you have no headroom. In practice, many sysadmins will draw a line at 0.70:

  • The “Need to Look into it” Rule of Thumb: 0.70 If your load average is staying above > 0.70, it’s time to investigate before things get worse.

  • The “Fix this now” Rule of Thumb: 1.00. If your load average stays above 1.00, find the problem and fix it now. Otherwise, you’re going to get woken up in the middle of the night, and it’s not going to be fun.

  • The “WTH is going on!?” Rule of Thumb: 5.0. If your load average is above 5.00, you could be in serious trouble, your box is either hanging or slowing way down, and this will (inexplicably) happen in the worst possible time like in the middle of the night or when you’re presenting at a conference. Don’t let it get there.

Now what about Multi-Core CPU? 

So you have a quad-processor system and it has a continuous load of 3.00? Well here you have nothing to worry about, your CPU is not over loaded.

On a multi-core CPU system, the load is relative to the number of processor cores available. The “100% utilization” mark is 1.00 on a single-core system, 2.00, on a dual-core, 4.00 on a quad-core, etc.

If we go back to the bridge analogy, the “1.00” really means “one lane’s worth of traffic”. On a one-lane bridge, that means it’s filled up. On a two-lane bridge, a load of 1.00 means it’s at 50% capacity — only one lane is full, so there’s another whole lane that can be filled.

Same with CPUs: a load of 1.00 is 100% CPU utilization on a single-core box. On a dual-core box, a load of 2.00 is 100% CPU utilization.

I hope this article was helpful, if you have any questions please feel free to contact me. If you would like to be notified of when I create a new post you can subscribe to my blog alert.

Leave a Comment

− 4 = 1