Basis Lab

Keeping the Answer Nearby

What You Actually Buy With a Hit

Last timeWhy the Same Question Keeps Arriving

A hit rate is not a score. It converts into two very different things, a faster average and a much lighter load on whatever sits behind the cache, and the second usually matters more.

Somebody reports that the cache is at ninety per cent and everyone nods. It is

worth slowing down on what that sentence actually promises, because it converts

into two quite different currencies and the conversion rate is not what most

people assume.

The blend

Every request takes one of two paths, and both have a cost you can measure. The

average is therefore a straightforward blend.

A hit costs one millisecond here and a miss costs forty, and the blend is those

two prices weighted by how often each path is taken.

FIG 1The average cost of a request, split into the two things it blends
stephit ratehits, at 1 millisecond eachmisses, at 40 milliseconds eachaverage milliseconds per requestwhat happened
150 per cent0.50 of them, so 0.500.50 of them, so 20.020.5Half the requests are now hits and they contribute half a millisecond. The average is very nearly the miss price, halved.
290 per cent0.90 of them, so 0.900.10 of them, so 4.04.9Nine requests in ten are hits, and they still account for less than a fifth of the average.
399 per cent0.99 of them, so 0.990.01 of them, so 0.41.4Only here do the hits finally cost more than the misses, and 0.99 plus 0.4 is 1.39, which a dashboard rounds to 1.4.
3 steps
The middle two columns are the blend, and the right-hand one is the larger until the hit rate is well above ninety per cent, because a miss costs forty times what a hit costs. An average on a dashboard is therefore mostly a measurement of your misses.

Read down the last column and the early progress looks like the valuable kind.

The first forty percentage points of hit rate bought a saving of fifteen and a

half milliseconds; the last nine bought three and a half. Measured in the

average, improving a mediocre hit rate looks like the work worth doing.

The lesson stops here

6 more paragraphs to go

You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.

The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.

See the planThe contents

This is the reading half

Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.

The contents

The rest of this course

  1. 01The Same Thing, Asked Again
  2. 02What You Actually Buy With a Hityou are here
  3. 03Choosing What to Forgetopening only
  4. 04When the Copy Stops Being Trueopening only
  5. 05Choosing How Far Away to Keep Itopening only
  6. 06The Ways a Cache Turns On Youopening only
  7. 07Many Boxes Pretending to Be Oneopening only
  8. 08Telling Whether It Earns Its Placeopening only

Read alongside