What is the difference between "write-through" cache and "write-back" cache? Is one preferable to the other in some cases?
Caching is used to automatically move or copy the most active data to a higher-performing tier from a slower one. Today, that cache is often made up of flash, with the slower tier being hard disk drives. There are two types of caching technology: a read cache and a write cache. Read caching is generally considered the safer of the two because it only stores a copy of data in the cache area. If there is a cache failure, then the data is automatically retrieved from the primary storage tier.
There are three common forms of caching: write-around, write-through and write-back. In a write-around cache, all new or modified data is written to the hard disk tier first. Then, based on access patterns, a copy of that data may be promoted up to the high-performance cache tier. It has the value of extending the life of a flash-based cache tier because extraneous writes never get promoted to that tier. But performance may suffer on more active data until those access patterns can be analyzed and those data moved into the flash tier.
In a write-through cache, all new or modified data is written simultaneously to the flash cache and the hard drive tier, but acknowledgment of the write is not sent to the application until the hard drive tier successfully completes the write. This provides the same reliability as a write-around cache but pre-promotes active data by capturing it to the cache while it's being written to the hard disk. It has the downside of potentially wearing out the flash cache faster because all writes, cache-worthy or not, are written to flash.
A write-back cache also captures all new or modified data to the flash tier, but will copy that write to the second tier asynchronously as well. However, the write acknowledgement to the application comes after data is written to flash, not to the hard disk, meaning that writes now occur at flash speeds. But there is risk of data loss if the flash drive fails before data has been flushed to the disk tier.
This was first published in January 2014