Part 1 of 7 · 1 min read
Why this page comes seventh
In this module you will
- Define IOPS, throughput, latency, queue depth and utilisation, and relate them with Little's law.
- Read the counters of a disk in
/proc/diskstatsand turn two samples into rates. - Write a small C program that reports reads per second, MB/s, average latency and busy share of a disk.
- Use
ddwith and withoutO_DIRECTfor a rough test, and say what it can and cannot show. - Read a set of numbers and say whether a disk is the bottleneck.
Pages 1 to 6 built a model of storage: seek and rotation, scheduling, flash, interrupts, layers and RAID. A model helps only if it can be checked against a real machine. This page shows how to measure a disk on Linux with the counters that the kernel keeps, and how to read the result. Page 8 uses these measurements on a case study.
About this example About this example
Real: The C program in section 3 and the dd commands in section 4 were compiled or run on a Linux test machine (2 processors, kernel 6.18, glibc 2.39) with a virtual flash disk named vda. All printed figures are from that machine. The iostat and fio tools are not installed there, so they are described and not run.
Scripted: The reading rules in section 5 are a guide that the page states. They are not measured values.
Not real: The counters are per device and they are updated by the kernel, not by the disk. A virtual disk reports the time that the guest sees, which includes the host. A real hard disk would show much longer times for each read.