Curriculum / Part 1 · Foundations: what storage even is
Lesson 2

IOPS, throughput and latency

The three numbers that describe storage performance, how Little's Law ties them together, and how to measure them with fio and iostat.

⏱ 40 min5-question quizLab 1.1

The simple version

Picture a pizza kitchen. IOPS is how many pizzas leave per minute. Throughput is how much pizza (in kilograms) leaves per minute: big pizzas move more food even if fewer leave. Latency is how long one customer waits for their pizza.

If only one cook works and makes one pizza at a time, the kitchen is slow no matter how big the oven is. Add more cooks working in parallel (more queue depth) and many more pizzas leave per minute, until the oven itself is full.

The triangle

Throughput (B/s) = IOPS × block size

Example: 200,000 IOPS × 4 KiB ≈ 819 MB/s. The same drive doing 1 MiB reads might do 7,000 IOPS ≈ 7.3 GB/s.

A spec sheet that says "1.5 M IOPS" without block size, read/write mix and queue depth tells you very little. Small random I/O stresses IOPS; large sequential I/O stresses throughput.

Little's Law: why queue depth matters

Little's Law says the average number of requests in a system equals arrival rate × time in system. For storage:

Queue depth = IOPS × latency

→ IOPS = QD ÷ latency

QD 1 at 80 µs latency → 1 ÷ 0.00008 = 12,500 IOPS.
QD 32 at 80 µs (if the device keeps up) → 400,000 IOPS.

Once the device saturates, adding more queue depth only increases latency: IOPS stays flat while each I/O waits longer. That knee is what benchmarks are hunting for.

Averages hide the pain

Training jobs move in lockstep: the slowest worker sets the pace. That makes p99 and p99.9 latency (the slowest 1% and 0.1%) more important than the average. fio reports a full percentile table, so always read it.

Measuring it

# 4K random read, 4 jobs × QD32, bypassing the page cache. Read-only, safe on a data disk.
$ fio --name=randread --filename=/dev/nvme0n1 --rw=randread --bs=4k \
      --iodepth=32 --numjobs=4 --ioengine=libaio --direct=1 \
      --runtime=60 --time_based --group_reporting --readonly
Never point a write test (--rw=randwrite) at a raw device that holds data: it destroys it.

While it runs, watch the device from another shell:

$ iostat -x 1 nvme0n1

Key columns: r/s (read IOPS), rkB/s (throughput), r_await (average read latency in ms), aqu-sz (average queue size). %util is misleading on NVMe: it measures "busy at least once in the interval", and a parallel device can show 100% while far from saturated.

Tools

fio
Flexible I/O tester. The standard way to generate controlled load.
iostat -x 1
Per-device IOPS, throughput, latency and queue size every second (sysstat package).
fio --output-format=json
Machine-readable results including the latency percentiles.

Quiz

Lab

Lab 1.1 · fio shows low IOPS

A colleague benchmarked a new drive with fio --name=t --filename=/dev/nvme1n1 --rw=randread --bs=4k --runtime=60 --time_based --readonly and got about 12k IOPS. The datasheet promises far more. They think the drive is faulty.

Start lab 1.1 →