Example: Reduce Wear on Solid-State Drives by Defer-Write
Solid-state drives (SSDs) offer improved performance, more power efficient and noise reductions, compared with traditional rotating hard disk drives (HDDs). However SSDs have the limited life expectancy of erase/write cycles, after which they no longer perform reliably. Now with the Defer-Write feature wear on SSDs can be greatly reduced in three aspects.
1. Consolidate the multiple writes on the same address
When Defer Write is enabled, the multiple writes which target the same address are consolidated into one write, thus reducing a lot of redundant writes. The following is a simple experiment showing this effect.
Step 1. Create a cache task on a SSD partition (here drive F:) with Defer-Write enabled. To simplify the demonstration, set the write latency to 1 hour avoiding write-data synchronization during the experiment.
Step 2. Copy a file on another partition to drive F:. In this experiment the file size is about 300MB. From the statistics, you'll see that the Total Write increases about 300MB.
Step 3. Copy and overwrite the same file to drive F: again. Repeat this step N times. As expected, the Total Write increases about (N * 300) MB. Here N = 3.
Step 4. Click the Flush Write button to manually flush all the deferred data to the disk. You'll see that the final write bytes to the disk which indicated by Normal Write is only about 300MB, instead of ((N + 1) * 300) MB.
Note: When Defer-Write is on, Total Write refers to the total write bytes received from the file system and required to be written to the disk. Normal Write and Urgent Write refer to the total bytes written to the disk.
2. Support TRIM command to avoid writing deleted data
TRIM command was introduced for SSDs to facilitate garbage collection. Originally TRIM command can't prevent the data which will be deleted later from being written. Now it becomes possible with the Defer-Write feature. PrimoCache handles TRIM command and removes the corresponding writes in the cache, thus avoid writing redundant data.
The following experiment shows how Defer-Write works with TRIM commands.
Step 1 and Step 2 are same as that in the previous experiment described above.
Step 3. Permanently delete the file copied to the drive F:. Wait about 30 seconds after which Windows will issue TRIM command. Soon, the statistics will show the Trimmed Blocks which means the number of deferred blocks trimmed.
Step 4. To verify the effect, click the Flush Write button to manually flush all the deferred data to the disk. You'll see that the final write bytes to the disk are almost 0 instead of 300MB!
Note: the TRIM command only applies to Windows 7 and later OS. Also it requires NTFS file system.
3. Align and combine small writes to the SSD's block size
PrimoCache detects the SSD's block size and tries to align and combine small writes to the block size as possible while writing the deferred data. This helps to improve SSD's write efficiency and reduce write cycles.
With the Defer-Write feature, PrimoCache can avoid the redundant writes and reduce wear on SSDs, thus prolonging the lifespan of SSDs. Of course, Defer-Write comes with a risk that data may be lost on system crashes or power failures. It is recommended that you may only enable Defer-Write on volumes where temporary, unimportant or reproducible data is to be stored.