2026-07-24
You've built an SLRU cache with ghost entries and adaptive segment sizing — the hot/cold boundary shifts as the workload changes. But promotion is still binary: a probationary hit moves the entry into the protected segment, regardless of how many times it's been accessed. That's fine for uniform workloads, but it burns protected space on entries that got one lucky re-hit.
The problem. Consider a video streaming service. A trending clip gets 500 hits in an hour. A long-tail clip gets 2 hits in an hour. With naive SLRU, both promote to protected on the second hit. The trending clip deserves the seat; the long-tail clip is stealing it from something hotter. Adaptive sizing helps the boundary breathe, but placement inside the hot segment is still uninformed.
The pattern. Attach a small frequency counter (4 bits, saturating) to each entry. On a probationary hit, promote only if the counter clears a threshold that's itself adaptive — driven by the same ghost-hit signal that resizes the segments. When protected-ghost hits dominate, promotions were too eager: raise the threshold. When probationary-ghost hits dominate, promotions were too stingy: lower it.
Concrete example. Netflix's edge caches face exactly this. A CDN node holds ~200k video chunks. Uniform SLRU with adaptive sizing gets ~87% hit rate on a mixed workload. Add frequency-aware adaptive promotion and you land around 91% — the trending Squid Game chunk beats out the 2-hit indie documentary chunk for a protected slot. On a node serving 40 Gbps, that 4-point delta is roughly 1.6 Gbps of origin traffic you didn't pay for.
Rule of thumb. Set the initial promotion threshold to log2(protected_segment_size / probationary_segment_size) + 1. For a 4:1 hot/cold ratio, start at 3 — an entry needs 3 hits in probation before promoting. Then let the ghost-hit ratio nudge it: threshold += sign(protected_ghost_hits - probationary_ghost_hits) * 0.1 per adjustment window, clamped to [1, 8].
When it's overkill. If your working set fits in the protected segment, you don't need any of this — an LRU on the whole cache wins. Frequency-aware adaptive promotion earns its complexity when your workload is heavy-tailed and shifting: a small number of hot items dominate, but which items are hot changes over hours or days.
The trap. Don't reset counters on promotion. The whole point is that the protected segment remembers why the entry earned its seat — so demotion decisions can use the same signal.
