After my article Understanding CBRC (Content Based Read Cache) I received few direct questions about the BBRC exposed API methods exposedI in vSphere 5, as mentioned by William Lam in hist article New Hidden CBRC (Content-Based Read Cache) Feature in vSphere 5 & for VMware View 5? The questions were specifically targeting the RecomputeDigest_Task method.
Please read Understanding CBRC (Content Based Read Cache) before continuing…
CBRC has the ability to invalidate and regenerate the RAM-based cache in it’s entirety. When RecomputeDigest_Task is triggered the CBRC metadata is regenerated. Nothing really happens to the contents of the in-memory RAM cache. Evictions of the in-memory RAM cache are scheduled based on a predefined algorithm, which is either based on either LRU (Least Recently Used) or MFU (Most Recently Used) cache algorithms.
Least Recently Used (LRU): discards the least recently used items first. This algorithm requires keeping track of what was used when, which is expensive if one wants to make sure the algorithm always discards the least recently used item. General implementations of this technique require keeping “age bits” for cache-lines and track the “Least Recently Used” cache-line based on age-bits. In such an implementation, every time a cache-line is used, the age of all other cache-lines changes. LRU is actually a family of caching algorithms with members including: 2Q by Theodore Johnson and Dennis Shasha and LRU/K by Pat O’Neil, Betty O’Neil and Gerhard Weikum.
Most Recently Used (MRU): discards, in contrast to LRU, the most recently used items first. In findings presented at the 11th VLDB conference, Chou and Dewitt noted that “When a file is being repeatedly scanned in a [Looping Sequential] reference pattern, MRU is the best replacement algorithm.” Subsequently other researchers presenting at the 22nd VLDB conference noted that for random access patterns and repeated scans over large datasets (sometimes known as cyclic access patterns) MRU cache algorithms have more hits than LRU due to their tendency to retain older data. MRU algorithms are most useful in situations where the older an item is, the more likely it is to be accessed.
In summary, the in-memory RAM cache is dynamic and the only portion that gets regenerated is the metadata.