Block caching strategies
Read cache only (One way, write-around)
Changed blocks are written only and directly to the cached device. The SSD only invalidates its entry and fetch written data when a read request occurs. Only benefits for high read/write ratios.
Read and write cache (Full cache, write-through)
Changed blocks are written to both devices.
Read cache with buffered writes (write-back)
Blocks are written to both devices but delayed on the cached device, allowing writes reordering and optimizations.
Block caching modules
Linux kernel block layer cache, now mainstream.
Facebook’s own contribution module to disk acceleration.
The kernel device mapper. It is not intented to act as block caching/accelerator, but a trick makes SSD usable (or any other fast device) for acceleration purposes.
In fact, the point here is not to designate a cache (fast) device, but the slow ones: This is the write-mostly option that was primary intented to flag network block devices.
I/O bottleneck redirection
When using a block cache for a accelerating a pool of devices, the cache device might not be able to withstand the total amount of requested I/O and then have the reverse effect. Detecting I/O bottlenecks allows overriding the cache device and directing I/O directly to the backend devices. A hard disk can withstand a max of 200 IOPS, where a SLC SSD handles 5000 IOPS. Probably effectless with a 25 disks less pool then.
TRIM/discard support allows the filesystem to flag the physical block as no longer used. Otherwise, the device still see unallocated blocks as in use, and will experience performance decrease and write amplification problem as the block usage grows.
TRIM over mapper or RAID
This is the ability of passing trim commands to virtual devices, which then needs to issue the right/translated TRIM commands as well.
If the write amplification will happen by design, whether the device handles TRIM or not.
|cache size/device size ratio
|I/O bottleneck redirection
(Work In Progress)
(upper layer passthrough)
|RAID/DM TRIM support||YES
|write amplification issue||NO||YES
(lack of trim support from upper layer)
(caused by 1:1 mirroring)