-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Cache and Eviction
-
Storage Engines
-
StorEng - Defined Pipeline
When WiredTiger evicts a dirty page and the cache is not under too much pressure, WiredTiger uses "scrub" eviction. That means that after writing the reconciled page, WT reloads the resulting page image into memory, so the page stays in the WT cache. Without scrub eviction, evicting a dirty page removes the page from the cache.
Scrub eviction is useful because typically a dirty page is not one of the colder pages in the cache, and would not be evicted if WT selected eviction candidates in pure LRU order. Thus scrub eviction helps us avoid unnecessary cache misses.
But it is possible to perform scrub eviction on a relatively cold page, resulting in two evictions of the page without any benefit – first a scrub eviction of a dirty page, and subsequently a clean eviction of the resulting clean page.
This can happen because the check for whether to perform scrub eviction only considers how full the cache is, not the LRU status (i.e., read generation) of the evicted pages. Specifically, if we have a dirty page with a low read generation and we are above the clean eviction target, then we could pick that page for eviction, perform scrub eviction, and subsequently chose and evict it for clean eviction.
Intuitively, this should be a rare scenario. But we could avoid it by adding a check during page eviction to not scrub if the cache is over the clean eviction target and the target page has a low read generation.