Disk Latency Concepts
November 18, 2013Hard 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
Rotational Latency
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) |
5400 | 11 |
7200 | 8 |
10000 | 6 |
15000 | 4 |
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
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
Transfer Time
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.
From here the transfer time will also depend on the block size. If we assume a 4K block size and a transfer rate of 151MB we can use the following equation
Transfer time = blocksize / Sustained transfer rate
.0325ms = 4 / 123
Seek time is normally defined as a track-to-track seek not sector, sectors a.k.a blocks are the basic data units that reside on a track. This article also doesnt describe zones and their effect.
The article also seems to finish prematurely. A little bit more explanation and/or examples of what the effect of the combinations are might finish it off nicely.
To calculate the maximum rotational latency = 6000/RPM <— 60000 (not 6000)
(60 seconds in a minute * 1000 to get milliseconds / Revolutions Per minute)
Thanks! Making the correction.
Seek time is track to track not sectors
[…] An SSD has a completely different architecture from an HDD. HDDs utilize a magnetic platter with a seeking arm to store and find information. The seeking arm moves back and forth, reading and writing information, while the platter spins. Obviously, a spinning platter isn’t very energy efficient. On the other hand, SSDs are basically large flash drives. They use NAND flash to store the data, and an electronic controller to access that storage. This results in less energy use, due to zero moving parts. In addition, the information is read and written much faster, resulting in a much lower latency. […]
Awesome! Thanks for sharing 🙂