Definition · Hit rate as a function of cache sizeFor a Zipf workload over N keys with exponent s, a cache holding the C most popular keys has hit rate h(C) = H(C, s)/H(N, s), for C from 0 to N.
h(0) = 0 and h(N) = 1. Between them h is strictly increasing and concave: each additional key adds p_{C+1}, and the probabilities are decreasing, so the increments shrink.
That is the whole model, and the assumption inside it is worth naming: the cache holds the right C keys. No online policy knows which those are, so h(C) is an upper bound on what a cache of C slots achieves on this workload, reached only if the popularity ranking is stable and the policy is good.
Inverting the curve: the C a target costs
To find the smallest C reaching a target h, add probabilities in rank order until the running total crosses it. No formula is needed and none exists in closed form for integer C; the lab runs the scan over exact fractions, so the C it reports is the smallest one, not the smallest one up to rounding.
N = 50, s = 2 running total of p_i, in rank order
C h(C) target reached
1 61.533%
5 90.061% ← 90% costs 5 keys, a tenth of the catalogue
10 95.363% ← 95% costs 10
28 99.060% ← 99% costs 28, more than half the catalogue
47 99.923% ← 99.9% costs 47
Example · What the second nine costsFrom 90% to 99% the cache goes from 5 keys to 28: twenty-three more keys, 5.6 times the memory. From 99% to 99.9% it goes from 28 to 47, and the catalogue only has fifty keys in it — past that point you are not caching, you are copying.
Put the two courses together and the trade is visible. Five keys of cache cut the backend load by a factor of ten (from 100% to 10% of λ); twenty-eight keys cut it by a hundred. The second factor of ten cost 5.6 times the memory of the first. Whether that is a good deal depends entirely on what the backend was doing at the higher load, which is the ρ of Hit Rate and Backend Load.
This replaces a number you were previously handed
“Memory and the Working Set” sized a cache by stating a hot fraction — assume ten per cent of the data is hot, multiply by the row size, buy that much memory. That is a serviceable estimate and it is an assumption. Here the hot fraction is a result: it comes out of N and s, and at N = 50 and s = 2 the ten per cent that lesson assumed turns out to deliver 90.061%, which is either lucky or a coincidence depending on the workload.
So the honest procedure is the other way round from the one that course taught: measure the skew, choose the hit rate you need from what the backend can take, and let the curve tell you the cache size. If the skew is unknown, bracket it — compute the required C at s = 1 and at s = 2 and carry both numbers, which is the error bar Capacity Estimation asked you never to drop.
One caution about the flattening. The curve says the last nine is expensive in memory; it does not say the last nine is worthless. Whether it is worth buying is a question about the backend, and there the same nine is a tenfold cut in load every time. Read the two curves together or you will talk yourself out of a cache that was about to save a database.