Compare hit-rate curve, stack-distance sketch, and latency breakdown to see where adding cache stops helping.
Parameters
Cache capacity C6 slots
Number of slots the cache can hold at once.
Working-set size W16 keys
Total number of distinct keys that get accessed.
Locality α0.90
How strongly access concentrates on a few keys (Zipf). 0 = uniform.
While paused, move the sliders to update the result instantly.
Real-time LRU cache animation
Green flash = HIT (move the key to the front); red flash = MISS (evict the least-recently-used slot at the tail, insert at the front). Left is MRU (most-recently used), right is LRU (least-recently used). The request stream has Zipf-like locality.
Real LRU hit rate depends strongly on the access distribution. This model uses a locality factor to study capacity sensitivity before detailed traces.
How to read it
The hit-rate curve shows where capacity improvements saturate.
The stack sketch explains why recent items remain in cache.
The latency view shows miss rate turning directly into backend load.
Learn Cache Hit Rate Lru by dialogue
🙋
When reading Cache Hit Rate Lru, where should I look first? Moving Working set W changes both the plots and the result cards.
🎓
Start with Hit rate, but do not treat the number as the whole answer. Use LRU hit-rate curve to confirm the assumed state, then read Stack-distance sketch for the distribution or trend. The hit-rate curve shows where capacity improvements saturate.
🙋
I can see why Working set W changes Hit rate. How should I judge the influence of Cache capacity C?
🎓
Move Cache capacity C in small steps and watch Miss rate. That reveals which term is controlling the result. Real LRU hit rate depends strongly on the access distribution. This model uses a locality factor to study capacity sensitivity before detailed traces. A single operating point is not enough; sweep the realistic scatter range.
🙋
What is Latency and load for? It feels like the ordinary curve already tells the story.
🎓
Latency and load is for finding boundaries where the condition becomes risky or margin collapses quickly. The stack sketch explains why recent items remain in cache. In Early sizing of web or API caches, the important question is often what happens after a small change, not only the nominal value.
🙋
So if Hit rate is within the target, can I accept the condition?
🎓
Treat this as a first-pass review. It helps with Estimating database or CDN miss load and Comparing cache cost against latency improvement, but final decisions still need standards, measured data, detailed analysis, and vendor limits. The latency view shows miss rate turning directly into backend load.
Practical use
Early sizing of web or API caches.
Estimating database or CDN miss load.
Comparing cache cost against latency improvement.
FAQ
Start with Hit rate and Miss rate. Then use LRU hit-rate curve to confirm the assumed state and Stack-distance sketch to read distribution or bias. The hit-rate curve shows where capacity improvements saturate
Move Working set W alone, then move Cache capacity C by a comparable amount and compare the change in Hit rate. Latency and load shows combinations where margin or performance changes quickly.
Use it for Early sizing of web or API caches. Instead of trusting a single point, widen the input range and check whether Hit rate keeps enough margin before moving to detailed analysis.
Real LRU hit rate depends strongly on the access distribution. This model uses a locality factor to study capacity sensitivity before detailed traces. Final decisions still require standards, measured data, detailed analysis, and vendor limits.
How to Use
Enter working-set size W (item count) and cache capacity C (item count)
Set locality α (0.2–8, default 2.2): higher values concentrate access on a subset and raise hit rate for the same capacity
Enter request rate (req/s) and miss penalty (ms); hit rate, miss rate, average added latency and backend load update live
Increase cache capacity C and watch where the hit-rate gain saturates and backend load falls
Worked Example
Using the defaults (working set W = 50,000 items, cache capacity C = 8,000 items, locality α = 2.2, 5,000 req/s, 30 ms miss penalty): hit rate H = 1−exp(−α·C/W) = 1−exp(−2.2×8000/50000) ≈ 29.67%, miss rate 70.33%, average added latency = 30×0.7033 ≈ 21.1 ms, backend load = 5,000×0.7033 ≈ 3,516 req/s. Doubling the cache to C = 16,000 items raises the hit rate to 50.54% and drops backend load to about 2,473 req/s; gains diminish as capacity grows.
Practical Notes
Cache-to-working-set ratio below 30% typically yields <65% hit rates; financial trading systems maintain 60%+ ratios to sustain sub-3ms latencies
Locality degrades under cache-oblivious workloads (random access patterns); shuffle operations in Spark reduce effective locality from 0.9 to 0.55
Miss penalty dominates latency impact at high request rates; a single 50ms backend round-trip at 100,000 req/s adds 5ms average latency across all requests
LRU eviction causes pathological behavior when working-set exceeds cache by >3x with poor locality; consider two-tier (hot/warm) strategies