Turn a hit rate into backend load and latency
(1 − h)λ and the ρ it leaves the backend at, the mean latency by expectation, and the reason the p99 is the miss latency whenever the miss rate is at least one per cent.
A cache is a number — the miss rate — and every decision about it is arithmetic on that number: what it does to the backend, what it does to the average and to the tail, how big the cache must be given how skewed the requests are, how stale it is allowed to be, and what happens in the second after a hot key expires.
Overview
By the end you can convert a hit rate into backend load and into latency, size a cache from the skew of its workload, judge a policy on a trace, and price the two failure modes a cache has: staleness and the stampede.
(1 − h)λ and the ρ it leaves the backend at, the mean latency by expectation, and the reason the p99 is the miss latency whenever the miss rate is at least one per cent.
The top-k share under a Zipf popularity as a ratio of harmonic numbers, the C that reaches a target hit rate, and the diminishing returns that make the next nine expensive.
Hits for FIFO, LRU, LFU and farthest-in-future at two cache sizes, with the optimum as the bound and Belady’s anomaly as the reason a bigger cache is not a guarantee.
The stale fraction for a TTL against an update interval, the miss rate a short TTL buys, the λ·d requests that pass through at expiry, and what coalescing reduces them to.
Lessons
What the miss rate does first, then what decides it (skew, size, policy), then the two ways a cache goes wrong, and last the two places a cache is something else: a second level, and a CDN.
Capacity Estimation and Queues and Utilisation. Discrete Mathematics “Expected Value”, “Conditional Probability” and “Independence”. Algebra “Piecewise Functions” and “Sigma Notation”.
State the miss rate, not the hit rate, whenever you are talking about the backend. Ninety per cent and ninety-nine per cent sound adjacent; ten per cent and one per cent do not, and the backend sees the second pair.
Run the policy lab at two cache sizes before reading the anomaly lesson. Seeing FIFO lose hits when the cache grows is more convincing than the sentence that says it does.
Treat the TTL formula as a sensitivity, not a prediction. It assumes periodic updates and a uniform refresh phase, and the timeline in the lab exists so that you can see the assumption rather than take it.
Cache coherence protocols; this course’s caches are independent copies with a TTL, not a coherent memory system.
CPU caches beyond the latency table of “Latency Numbers on a Log Scale”.
Eviction implementations — the data structures that make LRU cheap are Algorithms’ business, not this course’s.