How is load average calculated

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux (all versions)

Issue

  • How is a load average calculated?
  • What can be considered 'high load'?

Resolution

  • A load average is calculated by the following expression :

      load(t) = n+((load(t-1)-n)/e^(interval/(min*60)))
    
  • load(t): load average at a time of t.

  • n: number of threads in running or uninterruptible sleep state.

  • interval: calculate interval (seconds). 5 seconds in RHEL.

  • min: average time (minute).

How to interpret the value?

Although there are many factor to consider when analyzing the load on the system, a good starting point is comparing the load value with the number of CPU cores available.
If load represents the workload, the number of CPU core represents the workforce. Having a load value lower than the number of CPU cores is the desired status. Here number of CPU cores represents number of logical CPU's.

For example a load of 8 on a 2 core CPU can be considered high while the same load on a 32 core system can be considered normal.
Sometimes it's helpful to consider load as percentage of the available resources (the load value divided by the number or cores). Example: load of 0.5 on a dual core system can be 25% load, a load of 2 on a single core system can be 200% load, a load of 160 on a 16 core system can be 1000% load (anything above 100% is considered 'high load').

Root Cause

Diagnostic Steps

A graph can be drawn using gnuplot to visualise the behaviour:

RHEL 5:

$ cat load.plt 
load(x,m) = (x<=0.0) ? 0.0 : n+((load(x-1)-n)/exp(5.0/(m*60.0)))
set xrange[0:90]
n=1
plot load(x,1)
replot load(x,5)
replot load(x,15)
$ gnuplot 
gnuplot> load "load.plt"

RHEL 6:

$ cat load.plt 
set multiplot;
load(x) = (x<=0.0) ? 0.0 : n+((load(x-1)-n)/exp(5.0/(m*60.0)))
set xrange[0:90]
set yrange[0: 1]
n=1
set title "Show moving avg over 1, 5, 10 minutes w/ 1 runnable thread'
plot m=1,  load(x) title 'loadavg(1)' with lines lc rgb 'red', \
     m=5,  load(x) title 'loadavg(5)' with lines lc rgb 'blue', \
     m=10, load(x) title 'loadavg(10)' with lines lc rgb 'purple';
unset multiplot;
$ gnuplot 
gnuplot> load "load.plt"

 


The following information has been provided by Red Hat, but is outside the scope of the posted This content is not included.Service Level Agreements and This content is not included.support coverage. The information is provided as-is and any configuration settings or installed applications made from the information in this article could make the Operating System unsupported by Red Hat Global Support Services. Use of the information in this article at your own risk.

There are stack and recursion limits within gnuplot that prevent plotting out much beyond the 90 second threshold in the above plots. A This content is not included.loadavg.c program is available, as is and unsupported. When run, the program creates a set of data files and creates a gnuplot bash script that plots those data files. By using a program that avoids the recursion and stack limits it is able to plot out to 10 minutes and beyond to show the whole moving average calculates of all three 1 minute, 5 minute and 10 minute moving averages.

 
Loadavg plot
Loadavg plot with 1 runnable thread
SBR
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.