You must have seen the three magical numbers in Linux called the ‘Load Average’. In fact, all Unix based systems like Linux, MAC etc display these Numbers. Although they are not self-explanatory, it’s easy to get familiar with them. In this article, we will discuss Monitoring Performance and Understanding Load Average of a Linux System.
What is Load Average?
Before we go any further, let’s understand a very important term called System Load.
System Load/CPU Load: It is the number of processes that are running or waiting for the CPU. Also, it is the measure of CPU under or over utilization in a Linux System. Load average is the average load calculated over 1, 5 and 15 minutes. It is represented by 3 integers which are the average load in the past 1, 5 and 15 minutes respectively.
How to Find Load Average?
Many graphical and terminal based utilities display the Load Average, including the Top Command. However, the easiest way to access it is using the ‘uptime‘ command in terminal. This command shows your computer’s load average as well as uptime. The uptime command works on all Linux, Mac OS, and other Unix based Systems.
$ uptime 17:20:37 up 4 days, 5:55, 1 user, load average: 2.94, 3.32, 3.06
You can also use the Top Command to display the same.
top top - 17:27:39 up 4 days, 6:02, 1 user, load average: 2.06, 2.83, 2.95 Tasks: 353 total, 2 running, 281 sleeping, 0 stopped, 0 zombie %Cpu(s): 1.9 us, 1.1 sy, 0.0 ni, 96.5 id, 0.4 wa, 0.0 hi, 0.1 si, 0.0 st KiB Mem : 8058748 total, 291716 free, 4829680 used, 2937352 buff/cache KiB Swap: 7812092 total, 7751280 free, 60812 used. 2195768 avail Mem
Understanding the Load Average Output
What do these numbers mean? They are clearly not self-explanatory.
Each running process either using or waiting for CPU resources adds 1. So, if your system has a load of 3, three processes are either using or waiting for the CPU.
For instance, consider a the following:
load average: 1.20, 0.60, 4.59
From left to right, you can read the output as follows:
Load Average in the last One Minute: 1.20
Load Average in the last Five Minutes: 0.60
Load Average in the last Fifteen Minutes: 4.59
Some people misunderstand that higher the number, slower the system will be. However, this is not always true. It depends on the number of CPUs you have in your system.
Single CPU System
Assuming you have a Single CPU System, the numbers mean the following:
- In the past one minute, there were on average 0.20 processes waiting for the CPU. It was overloaded by 20% on average (1.20).
- In the last five minutes, the CPU was idle for 40% of the time (0.60).
- In the last fifteen minutes, the CPU was overloaded by 359%. Also, there were on average 3.59 processes waiting for the CPU.
You probably don’t have a single CPU system. It works a bit differently on multi-core CPU systems. To find the number of CPUs your system has, use the following command:
$ nproc 8
Multi-Core CPU System
Assuming, you have a dual-core system the numbers would mean the following:
- The CPUs were 80% idle on average in the last minute.
- The CPUs were idle for 140% of the time (0.60) in the past five minutes.
- They were overloaded by 259% in the past fifteen minutes. Also, there were on average 2.59 processes waiting for the CPU.
Therefore, a 5.79 in a single core system would mean massively overloaded. However, it would work perfectly fine on a system with 8 CPUs.
In conclusion, we discussed Monitoring System Performance and Understanding Load Average in Linux. A higher number does not always mean an overloaded system. You must always consider the number of CPUs you have in your system before making any conclusions. Learn more about Load on Wikipedia.
You might be interested in learning more about Linux on Concatly!
Vishesh is currently working as an Intermediate Software Engineer with Orion Health, New Zealand. He graduated with a Masters in Information Technology from the University of Auckland in 2021. With more than 4 years of work experience, his expertise includes Java, Python, Machine Learning, PHP, Databases, Design and Architecture.