What is a cache hit rate, and how does it relate to the average time a request takes?
Sketch your own answer first, then compare it with the one below.
A strong answer
Hit rate is the share of requests the cache answers itself. A hit is served from fast memory. A miss goes to the slower source and usually fills the cache on the way back.
Average time is a blend of the two: hit rate times hit time, plus miss rate times miss time. That is linear in hit rate, so each extra point of hit rate saves the same amount of time per request. What changes near the top is the load on the backing store, which is proportional to the miss rate: going from a very high hit rate to a slightly higher one cuts backend traffic by a large fraction.
Hit rate depends on three things: how skewed the request popularity is, how big the cache is compared with the set of hot keys, and how good the eviction policy is at keeping the hot keys. If requests are uniform over the keyspace, no policy can beat cache size over keyspace size.
The average also hides the misses. The slow tail is the misses, so the miss path still has to be fast enough.
Sources
- Lee Breslau, Pei Cao, Li Fan, Graham Phillips, Scott Shenker (1999). Web Caching and Zipf-like Distributions: Evidence and Implications.