Cache is used differently in hybrid and all-flash configurations. In hybrid disk-group configurations (which use mechanical HDDs for capacity and flash SSD devices for the caching), the caching algorithm attempts to maximize both read and write performance. The flash SSD device serves two purposes: a read cache and a write buffer. 70 percent of the available cache is allocated for storing frequently read disk blocks, minimizing accesses to the slower mechanical disks. The remaining 30 percent of available cache is allocated to writes. Multiple writes are coalesced and written sequentially if possible, again maximizing mechanical HDD performance.
In all-flash configurations, one designated SSD flash device is used for the cache, while additional SSD flash devices are used for the capacity. In all-flash disk-group configurations, there are two types of flash SSDs: a very fast and durable flash device that functions as write cache and more cost-effective SSD devices that function as capacity. Here, the cache-tier SSD is 100 percent allocated for writes. None of the flash cache is used for reads; read performance from capacity-tier flash SSDs is more than sufficient for high performance. Many more writes can be held by the cache SSD in an all-flash configuration, and writes are only written to capacity when needed, which extends the life of the capacity-tier SSD.
While both configurations dramatically improve the performance of VMs running on vSAN, all-flash configurations provide the most predictable and uniform performance regardless of workload.
The read cache, which only exists in hybrid configurations, keeps a collection of recently read disk blocks. This reduces the I/O read latency in the event of a cache hit; that is, the disk block can be fetched from cache rather than mechanical disk. For a given VM data block, vSAN always reads from the same replica/mirror. When there are multiple replicas (to tolerate failures), vSAN divides up the caching of the data blocks evenly between the replica copies.
If the data block being read from the first replica is not in cache, the directory service is referenced to discover whether or not the data block exists in the cache of another mirror (on another host) in the cluster. If the data block is found there, the data is retrieved. If the data block is not in cache on the other host, then there is a read-cache miss. In that case, the data is retrieved directly from the mechanical HDD.
The write cache, found in both hybrid and all-flash configurations, behaves as a non-volatile write buffer. This greatly improves performance in both hybrid and all-flash configurations and also extends the life of flash capacity devices in all-flash configurations. When writes are written to cache, vSAN ensures that a copy of the data is written elsewhere in the cluster. All VMs deployed with vSAN are set with a default availability policy that ensures at least one additional copy of the VM data is available. This includes making sure that writes end up in multiple write caches in the cluster.
Once an application running inside the guest OS initiates a write, it is duplicated to the write cache on the hosts that include replicas of the storage objects. This means that, in the event of a host failure, a copy of the data is in cache and no data loss occurs. The VM simply uses the replicated copy of the cache data.