Β§37.4I/O Time: Doing The Math

Part III OSTEP pp. 438–441 Β· ~4 min read

With the model in hand, we can put numbers to disk performance. I/O time is the sum of the three costs:

TI/O=Tseek+Trotation+TtransferT_{I/O} = T_{seek} + T_{rotation} + T_{transfer}

The rate of I/O β€” handy for comparing drives β€” is the transfer size over that time:

RI/O=SizetransferTI/OR_{I/O} = \frac{\text{Size}_{transfer}}{T_{I/O}}

Aside: Dimensional Analysis

Given only RPM, how long is one rotation in ms? Cancel units, chemistry- class style. For a 10K RPM drive: 1Β minute10,000Β rotΓ—60Β s1Β minuteΓ—1000Β ms1Β s=60,000Β ms10,000Β rot=6Β ms/rotation\frac{1\ \text{minute}}{10{,}000\ \text{rot}} \times \frac{60\ \text{s}}{1\ \text{minute}} \times \frac{1000\ \text{ms}}{1\ \text{s}} = \frac{60{,}000\ \text{ms}}{10{,}000\ \text{rot}} = 6\ \text{ms/rotation}. The same trick turns a 100 MB/s rate into β€œhow long for a 512 KB block?” β€” just line up the units so they cancel.

Two drives, two workloads

To feel the numbers, compare two Seagate drives across two workloads: a random workload (small 4 KB reads scattered across the disk β€” common in databases) and a sequential one (one long contiguous transfer).

Figure 37.5: two real Seagate drives β€” a "performance" SCSI drive and a "capacity" SATA drive.
Cheetah 15K.5Barracuda
Capacity300 GB1 TB
RPM15,0007,200
Average seek4 ms9 ms
Max transfer125 MB/s105 MB/s
Platters44
Cache16 MB16/32 MB
Connects viaSCSISATA
Dotted-underlined cells have explanations β€” click one.

On the Cheetah, a random 4 KB read costs a 4 ms seek, a 2 ms average rotation (15,000 RPM β†’ 4 ms/rotation β†’ 2 ms average), and a vanishing ~30 Β΅s transfer β€” so TI/Oβ‰ˆ6Β msT_{I/O} \approx 6\ \text{ms} and RI/Oβ‰ˆ0.66Β MB/sR_{I/O} \approx 0.66\ \text{MB/s}. A sequential 100 MB read pays one seek + rotation and then transfers for ~800 ms, hitting nearly the peak 125 MB/s. The result is staggering:

Figure 37.6: rate of I/O under two workloads. Look at the gap.
CheetahBarracuda
R_I/O Random (4 KB reads)0.66 MB/s0.31 MB/s
R_I/O Sequential (100 MB)125 MB/s105 MB/s
Sequential Γ· Randomβ‰ˆ 190Γ—β‰ˆ 340Γ—
Dotted-underlined cells have explanations β€” click one.

Sequential vs. random throughput (MB/s). The random bar is there β€” it’s just ~190Γ— smaller.

Cheetahsequential β€” 125 MB/srandom β€” 0.66 MB/s (β‰ˆ190Γ— slower)Barracudasequential β€” 105 MB/srandom β€” 0.31 MB/s (β‰ˆ340Γ— slower)

Tip: Use Disks Sequentially

Whenever possible, transfer data to and from disk sequentially. If not, at least use large chunks β€” the bigger the better. Little random I/Os make performance suffer dramatically (and so, the authors warn, will you, knowing the suffering your careless random I/Os have wrought).

Aside: Why β€œAverage Seek β‰ˆ 1/3 Of Full”

You’ll often see average seek quoted as one-third of the full-stroke seek. It comes from average seek distance: over all pairs of tracks x,yx, y in [0,N][0, N], the mean of ∣xβˆ’y∣|x - y| works out (by integrating and dividing by N2N^2) to 13N\tfrac{1}{3}N. So the average seek spans a third of the disk β€” hence a third of the full seek time.

Next: given that random I/O is so costly, the OS can reorder requests to minimize it β€” disk scheduling.

Check yourself: I/O time math

1.A 10,000 RPM disk β€” how long is one rotation, and what's the average rotational delay?

2.On the Cheetah, a random 4 KB read achieves only ~0.66 MB/s. Why so slow?

3.How does sequential throughput compare to random on these drives?

4.What is the single most important disk performance tip from this section?

5.Why is the average seek often quoted as about one-third of a full-stroke seek?

5 questions