For all the great things about SSDs, they’re still expensive. There are more than half a dozen excellent 2 TB hard disks available for less than $/£/€100 each, yet for the same money you’re unlikely to get a decent SSD much larger than 1 TB. When your storage needs are even greater, SSDs quickly become prohibitively expensive.
Yesterday’s comparison of performance between HFS+ and APFS on hard disks reminded me (thank you, Paolo) that getting the best out of hard disks is considerably more complicated than might appear. One factor is where files are stored on the hard disk platter.
Data is stored on hard disks in circular tracks of magnetic material. To store each file requires multiple sectors of those tracks, each of which can contain 512 or 4096 bytes. As the length (circumference) of the tracks is greater as you move away from the centre of the platter towards its edge, but the disk spins at a constant number of revolutions per minute (its angular velocity is constant), it takes a shorter time for sectors at the periphery of the disk to pass under the heads than for those closer to the centre of the platter. The result is that read and write performance also varies according to where files are stored on the disk: they’re faster the further they are from the centre.
You can use this to your advantage. Although you don’t control exactly where file data is stored on a hard disk, you can influence that. Disks normally fill with data from the periphery inwards, so files written first to an otherwise empty disk will normally be written and read faster. If you can’t do that, you can divide the disk into two or more partitions (in APFS, containers), as the first will normally be allocated space on the disk nearest the periphery, so read and write faster than later partitions, which will be allocated slower space closer to the centre.
To assess how much difference to performance this makes, I divided up a popular sub-$/£/€100 compact external 2 TB hard disk into ten APFS containers, and using Stibium measured the read and write performance of each container separately. Results range from an impressive 148-149 MB/s in the first container, at the edge of the platter, to a dismal 78-81 MB/s in the last tenth of the disk, closest to the centre. These are shown in the graph below.
Although these curves aren’t far from being straight lines, there’s a noticeable falloff in performance in the central quarter of the disk (considered in terms of the data stored there).
From my previous testing, there’s no reason to suspect that results for HFS+ would be any different to those for APFS, unless the file system metadata had become fragmented, of course.
If you need the best performance from a hard disk, you should seriously consider using this to your advantage. Adding a second container or partition of 20% of the total capacity of the disk won’t lose you much space, but it will ensure that performance doesn’t drop off to little more than half that achieved in the most peripheral 10%.
Note that this only applies to traditional rotating hard disks, and doesn’t affect SSDs; they can suffer poor performance when their SLC write cache becomes exhausted as a result of writing large quantities of data in a short space of time, and faster SSDs can also suffer from thermal throttling.
Nothing seems able to achieve its claimed performance all the time, does it?