-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Cache and Eviction
-
None
-
Storage Engines, Storage Engines - Transactions
-
0.007
-
None
-
None
Symptom
When a tree that dominates the cache has low eviction yield, most of its walk passes run on a small remainder of its full target, give up without queuing anything, and keep the tree backed off. While backed off, the walk queues the tree's internal pages, which free little space and are read back.
Field data (HELP-103000, $collStats on 8.0.34, collection holding 88-94% of the cache):
- 49% / 66% of the collection's walk passes targeted under 10 pages.
- The tree was mostly held at the maximum walk period (100).
- 85% / 65% of the pages evicted from it were internal pages.
Code
if ((target_pages == 0) || btree->evict_walk_progress >= btree->evict_walk_target) {
btree->evict_walk_target = target_pages;
btree->evict_walk_progress = 0;
}
target_pages = btree->evict_walk_target - btree->evict_walk_progress;
The full target (about 350-400 pages for this tree) is recomputed only once progress reaches it, so later passes run on the remainder. With min_pages = 10 * target_pages, a small remainder gives up after a few pages. Internal pages without a resident child are queueable only while evict_walk_period != 0.
Repro (develop cbfc07e3df)
- One large table, 10M rows of 100 B, 4 KB leaf pages, 512 B internal pages, 50 MB cache, so resident internal pages have under one resident child on average.
- Random reads and removes on the large table, random updates on 10 small tables; clean-only targets, 4 eviction threads, no checkpoints, 60 s.
- Record target, progress, pages seen and queued, and internal pages queued per pass.
| Shallow control | Deep, sparsely cached | |
|---|---|---|
| Passes per full-target cycle | 4.9 | 71.4 (44.1 under 10 pages) |
| Sub-10 passes queuing nothing | 4.1% | 94.3% |
| Passes starting with period > 0 | 2.0% | 36.3% |
| Pages queued / seen | 37.1% | 2.1% |
| Internal share of pages queued | 0% | 84.5% |
| Internal share of pages read | 0.02% | 28.0% |
Expected
A backed-off dominating tree should not spend most of its passes on tiny remainders. Options to evaluate on the repro above, alone and together with WT-19030: a floor on the per-pass target; resetting progress after a pass that queues nothing; not queuing internal pages on back-off.