What is system load?
Run the top
or uptime
commands:
$ uptime
19:36:03 up 5 days, 9:12, 8 users, load average: 0.05, 0.16, 0.21
$ top -bn1 | head -1
top - 19:36:07 up 5 days, 9:13, 8 users, load average: 0.05, 0.16, 0.21
The load averages stated here are:
/proc/loadavg
The first three fields in this file are load average figures
giving the number of jobs in the run queue (state R) or waiting
for disk I/O (state D) averaged over 1, 5, and 15 minutes. They
are the same as the load average numbers given by uptime(1) and
other programs.
Consider my load averages: 0.05, 0.16, 0.21
That means, over the last minute, on an average, 0.05 processes have been waiting for resources.
Should you be worried that the load average is 2? In general, if the load average is greater than the number of CPUs available, then some process had to idle around waiting for a CPU slot.
If the load average is less than the output of nproc
, you don't need to worry.
Also see: What does load average mean in unix/linux? As Braiam notes, the processes need not be waiting only for CPU: Understanding load average vs. cpu usage
System Load or System Load Average
It is run-queue i.e a queue of processes waiting for a resource(cpu, i/o etc.) to become available .
Consider a single-core cpu
as a single lane of traffic with bridge and process as cars.
Now in this situation System load is
- 0.0 - If there is no traffic on the road.
- 1.0 -If the traffic on the road is exactly the capacity of bridge.
- More than 1 - If the traffic on road is higher than the capacity of bridge and cars have to wait to pass trough the bridge.
This number is not normalized according to your cpu
.
In Multiprocessor system, load 2 mean 100 % utilization of we are using dual-core processor, load 4 means 100% utilization if we are using quad-core.
You can get your system load using
uptime
cat /proc/loadavg
top
$uptime 22:49:47 up 11:47, 4 users, load average: 2.20, 1.03, 0.82
Here the last three number representing the system load average for 1, 5 and 15 minutes respectively.
The example above indicates that on average there were 2.20 processes waiting to be scheduled on the run-queue measured over the last minute.
The system load is relevent to the number of the CPU cores, for exampleif you have a Quad Cores CPU (4 Cores) the value 1 means that the system load is on 25%, and 4 means 100%.