98

When issuing this command on Linux:

# cat /proc/loadavg
0.75 0.35 0.25 1/25 1747

The first three numbers are load averages. What are the last 2 numbers?

The last one keeps increasing by 2 every second, should I be worried?

Dario Seidl
  • 4,140
  • 1
  • 39
  • 55
Ulterior
  • 2,786
  • 3
  • 30
  • 58
  • 4
    Just a comment for anyone else wondering: If you do a `watch -n0.1 cat /proc/loadavg` you will see the last value increasing at that rate, because by definition every time you do a `cat` you spawn a new process. So just by looking at this file you are changing the result (reminds me of something). – billpcs Apr 23 '21 at 10:14
  • @billpcs Quantum mechanics! ;-) – Flurrywinde Dec 03 '22 at 01:56

5 Answers5

111

/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.

The fourth field consists of two numbers separated by a slash (/). The first of these is the number of currently executing kernel scheduling entities (processes, threads); this will be less than or equal to the number of CPUs. The value after the slash is the number of kernel scheduling entities that currently exist on the system.

The fifth field is the PID of the process that was most recently created on the system.

Tim Visée
  • 2,988
  • 4
  • 45
  • 55
auselen
  • 27,577
  • 7
  • 73
  • 114
  • 1
    Users should take these values into account while running GNU `make` with the `--load-average=N.N` parameter. If `make` causes the load average to be numerically higher than the number of CPU cores, `make` should be restarted with `--load-average` reduced. This way the system will not be overloaded by the compilation. –  Jun 22 '18 at 16:02
  • 2
    If system booted up before 5 minute, then how do they will calculate the 15 minute load average? Will they use only 5 minute data? – shafeeq May 15 '19 at 05:33
  • 3
    at least currently manual page does not contain words "less than or equal to the number of CPUs" and it is more than number of cpus when you have more runnable processes. – pal Feb 10 '20 at 00:12
  • 1
    The fifth field is not as described in the answer: in fact, this is the *last allocated PID*. – Mike Aski Jul 23 '20 at 17:00
26

I would like to comment the accepted answer.

The fourth field consists of two numbers separated by a slash (/). The first of these is the number of currently executing kernel scheduling entities (processes, threads); this will be less than or equal to the number of CPUs.

I did a test program that reads integer N from input and then creates N threads and their run them forever. On RHEL 6.5 computer I have 8 processor and each processor has hyper threading. Anyway if I run my test and it creates 128 threads I see in the fourth field values that are greater than 128, for example 135. It is clearly greater than the number of CPU. This post supports my observation: http://juliano.info/en/Blog:Memory_Leak/Understanding_the_Linux_load_average

It is worth noting that the current explanation in proc(5) manual page (as of man-pages version 3.21, March 2009) is wrong. It reports the first number of the forth field as the number of currently executing scheduling entities, and so predicts it can't be greater than the number of CPUs. That doesn't match the real implementation, where this value reports the current number of runnable threads.

  • 7
    Can confirm: kernel/sched/core.c nr_running() describes itself as collecting *runnable* as opposed to *running* tasks. – fche Apr 08 '16 at 14:13
  • For those who want to read the Juliano's blog post (Internet Archive's Wayback Machine has preserved it for you): https://web.archive.org/web/20170803030350/http://juliano.info/en/Blog:Memory_Leak/Understanding_the_Linux_load_average – GypsyCosmonaut Jul 30 '23 at 15:31
14

The first three columns measure CPU and I/O utilization of the last one, five, and 15 minute periods. The fourth column shows the number of currently running processes and the total number of processes. The last column displays the last process ID used.

https://docs.fedoraproject.org/en-US/Fedora/17/html/System_Administrators_Guide/s2-proc-loadavg.html

Piskvor left the building
  • 91,498
  • 46
  • 177
  • 222
  • 7
    I strongly object to this definition. The first three numbers doesn't measure the CPU and I/O utilisation *directly*, they are the average number of jobs in the run queue or waiting for I/O, as the answer from @auselen states. – Jan May 17 '17 at 12:40
  • It seems the Fedora documentation you have linked to doesn't have this properly documented... – Lifeboy Feb 08 '22 at 10:24
  • Sadly this link no longer exists. Shame, it sounds useful. – Simon Avery Apr 18 '23 at 14:45
9

The following page explains these in detail:

http://www.brendangregg.com/blog/2017-08-08/linux-load-averages.html

Some interpretations:

  • If the averages are 0.0, then your system is idle.
  • If the 1 minute average is higher than the 5 or 15 minute averages, then load is increasing.
  • If the 1 minute average is lower than the 5 or 15 minute averages, then load is decreasing.
  • If they are higher than your CPU count, then you might have a performance problem (it depends).
Dario Seidl
  • 4,140
  • 1
  • 39
  • 55
Validus Oculus
  • 2,756
  • 1
  • 25
  • 34
3

You can consult the proc manual page for /proc/loadavg :

$ man proc | sed -n '/loadavg/,/^$/ p'
       /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.  The fourth field consists of two  num‐
              bers  separated by a slash (/).  The first of these is the number of currently runnable kernel schedul‐
              ing entities (processes, threads).  The value after the slash is the number of kernel scheduling  enti‐
              ties  that  currently  exist  on  the  system.  The fifth field is the PID of the process that was most
              recently created on the system.

For that, you need to install the man-pages package on CentOS7/RedHat7 or the manpages package on Ubuntu 20.04/22.04 LTS.

SebMa
  • 4,037
  • 29
  • 39