Part 1 of 7 · 1 min read
Why this page comes last
In this module you will
- Follow a method for a slow-storage report: state the symptom, measure, find where the time goes, change one thing, measure again.
- Explain what
fsyncforces, and why onefsyncper record is expensive. - Count the device writes that a program causes, from
/proc/diskstats. - Compare the options of group commit by speed and by the data they can lose in a crash.
- Estimate how the same program would behave on a spinning disk, using the model of page 1.
Pages 1 to 7 gave a model of devices, a view of the kernel's I/O layers, and a way to measure. This page uses them together on one problem, in the order of a real investigation. It closes Level 8. Level 9 then explains file systems, including the journal that this case study meets, and Level 12 repeats the method on bigger systems.
About this example About this example
Real: The C program in section 2 was compiled with gcc -Wall -Wextra and run twice on a Linux test machine (2 processors, kernel 6.18, glibc 2.39). The disk is a virtual flash disk with an ext4 file system. The figures in the output blocks come from the first run, and the second run agreed within 10%.
Scripted: The story of a "log writer" and the user complaint are made up to give the work a shape. The estimate for a 7,200 RPM disk in section 5 is a model calculation and not a measurement.
Not real: A production service has several threads, other files, and a disk shared with other programs. The test machine has only this one writer, so its numbers are cleaner than a real server's.