Location: Home Page > Article Article
What is use of a hard disk cache? Detailed explanation of caching effect of solid state hard disk and mechanical hard disk.
When we buy a hard drive, in addition to interface, we are more concerned about size of hard drive's cache memory. As for Xiaobai, he did not understand role of hard disk cache at all, so what is use of hard disk cache? Let me share a detailed explanation of caching effect of solid state and mechanical hard drives.
SSD cache: taking care of writes is just a part-time job
Solid-state drives are very different. First, flash reads are faster than writes, which is inherently defined by MLC and TLC flash, and no special read cache is needed at all. In ATTO test results, gray bar indicating read speed will always be longer than red bar indicating write speed:
However, if you reduce test block to 64 KB, you may get different results: length of red bar exceeds gray bar for first time, and block write speed is less than 4 KB faster than read speed. speed!
This phenomenon is also very simple:The SSD caches blocks smaller than 4 KB, fills them up to 4 KB or 16 KB (1 page size), and then merges and writes them, resulting in faster writes. results than read. Flash's minimum write unit is Page. SSDs typically use 4KB as logical page size, while actual size of a Flash page is often 16KB. Only 512 bytes or 1KB, 2KB is not enough for minimum unit of one write , so they make most sense for caching and merging records.
A cache merge of data smaller than 4 KB requires only a small amount of space. The DRAM cache of SSDs is not for caching data, but to store FTL flash mapping table, which is critical for SSDs: manage logical addresses and flash physical addresses.
With advances in technology, DRAM cache is no longer a necessary component of an SSD. With latest NVMe protocol, SSD can use a small portion of allocated host memory space to store FTL mapping table, providing optimization and efficiency improvements.
The Toshiba Fusion NVMe Single-Chip Solid State Drive packs core management and flash as one unit, replacing DRAM cache with NVMe protocol's HMB function, and cache capacity is finally history. .
Finally, it is worth noting that for hard drives purchased in recent years, whether mechanical or solid state, cache size parameters cannot be found in new version of discovery software. For example, when CrystalDiskInfo detects a 2TB mechanical hard drive, HDTune simply marks its cache as n/a (does not exist). In fact, this is a limitation of ATA standard, at time of design, only 32MB of code was reserved, and now hard disk capacity exceeds 32MB, which cannot be correctly recognized.
Mechanical hard drive cache: luck can improve reading
Generally speaking, read and write speeds of mechanical hard drives are almost same. But if you use a smaller test block (64 KB) in ATTO test, you will find that read speed is significantly higher than write speed, and even the phenomenon of reading over 400 MB / s takes place: it is impossible to be that fast. usually .
In a mechanical hard drive, cache mainly plays role of speeding up reading. If a piece of data has just been read, keep data next to it in DRAM cache, and there is a chance of being hit by next read - speed of reading directly from DRAM cache is much faster than reading from DRAM cache. mechanical disc lot.
Hitting cache means a significant performance boost, which is primary function of a mechanical cache on a hard drive. In theory, a large cache does help improve read speed of mechanical hard drives, but improvement is very limited: it doesn't help most important random read speed.
A large amount of cache memory does not necessarily mean high performance. Currently, many mechanical hard drives with large caches of 128MB or more use SMR magnetic recording technology. The purpose of increasing cache size is to reduce performance degradation caused by CMP.
The above is a detailed explanation of caching features of mechanical hard drives and solid state drives. Generally speaking, caching features of mechanical hard drives and solid state drives are very different.