What is load average?

Load average is an indicator that represents the load status of the entire system. It is represented by “the number of processes waiting for “the number of processes waiting for execution per unit time and disk I/O waiting for one CPU”.

If yuo want to increase the throughput of the system, the goal is to reduce the load average.

The Linux kernel has a process descriptor for each process, and manages the state of the process in its state member. The state of the process is distinguished as follows.

TASK_RUNNING: Possible state. It can be run if the CPU is free.
TASK_UNINTERRUPTABLE: Uninterruptible wait state. Those that return in a short time, such as waiting for disk I/O.
TASK_INTERRUPTABLE: An interruptible wait state. The return time can not be predicted, such as waiting for user input.
TASK_STOPPED: Execution has been suspended. It will not be scheduled until it is resumed.
TASK_ZOMBIE: Zombie process. The child process has not exited and has not been waited on by the parent process.

ロードアベレージを確認するコマンド
[vagrant@localhost ~]$ uptime
08:42:40 up 1 day, 16:57, 1 user, load average: 0.00, 0.00, 0.00
[vagrant@localhost ~]$ uptime
08:43:36 up 1 day, 16:58, 2 users, load average: 0.13, 0.03, 0.01

[vagrant@localhost ~]$ w
08:44:33 up 1 day, 16:59, 2 users, load average: 0.05, 0.02, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
vagrant pts/1 192.168.35.1 08:43 1:08 0.42s 0.24s php -S 192.168.
vagrant pts/0 192.168.35.1 23:24 1.00s 7.38s 0.01s w

[vagrant@localhost ~]$ top
top – 08:45:38 up 1 day, 17:00, 2 users, load average: 0.02, 0.02, 0.00
Mem: 501796k total, 493992k used, 7804k free, 6144k buffers
Swap: 1015804k total, 419948k used, 595856k free, 30000k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6854 vagrant 20 0 100m 700 468 S 51.0 0.1 0:00.34 sshd
9368 vagrant 20 0 15020 1308 1008 R 51.0 0.3 0:00.28 top
1 root 20 0 19232 192 60 S 0.0 0.0 0:00.90 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
4 root 20 0 0 0 0 S 0.0 0.0 0:01.62 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 stopper/0
6 root RT 0 0 0 0 S 0.0 0.0 0:00.63 watchdog/0
7 root 20 0 0 0 0 S 0.0 0.0 3:13.04 events/0
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 events/0
9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 events_long/0
10 root 20 0 0 0 0 S 0.0 0.0 0:00.00 events_power_ef
11 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cgroup
12 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khelper
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 netns
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 async/mgr
15 root 20 0 0 0 0 S 0.0 0.0 0:00.00 pm
16 root 20 0 0 0 0 S 0.0 0.0 0:01.11 sync_supers
17 root 20 0 0 0 0 S 0.0 0.0 0:00.02 bdi-default

おおおおおおおおおお、なんかわかった気になってきた。すげえ。