Disk Latency ConceptsNovember 18, 2013
Hard drives are not the most fun thing to talk about, but it’s important to know some of the concepts when it comes to disk latency. Disk latency refers to the time delay between a request for data and the return of the data. It sounds like a simple thing, but this time can be critical to the performance of a system.
We should be surprised that traditional hard disks work at all when we consider that head designed to read minute magnetic fields sits 3 nanometers off a platter is spinning between 5400RPM and 15,000 RPM. Amazing when you stop to think about it huh?
Even with all that, we worry about how fast we can return data to a system.
Three specific calculations are used to determine the disk latency.
1. Rotational Latency
2. Seek Time
3. Transfer Time
Data is housed on the platters, and the platters spin. The readwrite head can’t be positioned on all of the data at the same time, so the platters spin around really fast to get the data under the readwrite head. The amount of time it take for the platters to spin the data under the head is the rotational latency.
To calculate the maximum rotational latency = 60000/RPM
(60 seconds in a minute * 1000 to get milliseconds / Revolutions Per minute)
In 2013 hard disks usually spin at a steady rate of:
|RPMs||Rotational Latency (ms)|
The average rotational latency for a disk is one-half the amount of time it takes for the disk to make one revolution.
Seek time is the amount of time it take for the ReadWrite head to move between sectors on the disk. Some times data needs to be written on the outside of the platters and sometimes inside. The readwrite head needs to move back and forth to get this information. The amount of time this takes is the “seek time”.
The maximum seek time is the time in milliseconds that a head needs to travel from the outermost track to the innermost track. This time is determined from the manufacturer.
The average seek time is then one-third the maximum seek time. I would explain this in further detail, but it involves calculus. If you’d like to dive deeper, i recommend looking into page 10 of this excerpt from “Operating Systems: Three Easy Pieces” By Remzi Arpaci-Dusseau, Andrea Arpaci-Dusseau
The speed of the disk components is only part of the struggle, there is also the amount of time it take for requests to get from the system to the disk.
In order to determine the transfer time we need to know the sustained transfer rate of the drive. This can be found from the manufacturer of the device.
Transfer time = blocksize / Sustained transfer rate
.0325ms = 4 / 123