Skip to content
Optimal Lab

DevOps · interactive

Reading load, CPU and I/O wait

top shows a load average and a CPU breakdown. On this 4-core machine, load means “tasks running or waiting”, so compare it with the core count, and check whether the CPU or the disk is the real bottleneck.

load average: 9.4, 8.8, 7.1

1, 5 and 15 minute averages · 4 cores

us6%
sy3%
wa84%
id7%

Runnable (R)

Waiting on disk (D)

us user · sy kernel · wa I/O wait · id idle. Amber squares: runnable tasks with no free core.

High load but the CPU is mostly idle! Linux counts tasks blocked on disk I/O (state D) in the load. The disk is the bottleneck.

Situation

Step 3 of 4

  1. 1

    Load = demand, not usage

    The average number of tasks running or waiting. Divide by cores: under 1 per core is fine.

    Compare the 1- and 15-minute numbers for trend.

  2. 2

    High load, high us/sy

    Tasks queue for a core. Profile the hot code or add CPUs.

    top · htop · mpstat 1

  3. 3

    High load, high wa, idle CPU

    Tasks are blocked on disk or network storage. More CPUs won't help; look at the disk.

    iostat -x 1 · iotop

  4. 4

    Check memory too

    Swapping turns memory pressure into disk I/O. In containers, look at limits and throttling, not just the host.

    free -h · vmstat 1

In production

Tools and technologies

The first tools anyone runs on a slow server.

Not tied to one language — use these names when you search docs or design a system.