Nine prohibitions and their escapes
What caching forbids
Each item is something no design can do. Each comes from a derivation in an earlier article.
- Freshness over a bypassable copy without paying coordination, verification, or staleness. There is no fourth currency.
- Buying hit rate in a linear way. C ≈ N^h at α = 1. And at α ≤ 1, a fixed cache against a growing corpus decays, silently.
- Optimal online eviction. A deterministic policy is k-competitive at best, a randomized one Θ(log k), and no policy escapes that.
- Exact decisions about reusing cached query fragments. This is NP-complete at best and undecidable in general.
- Exact invalidation, unless you keep the derivation graph at write granularity. Maintaining that graph costs about as much as the cache saved.
- Consistency across entries without a single designated version cell.
- Improving any percentile above h.
- Splitting one hot key across nodes by hashing.
- Caching a workload with no reuse. Nothing in the subject can replace reuse. This is the only prohibition with no escape at all.
The escapes and what each costs
| Escape | Buys | Costs | Who pays |
|---|---|---|---|
| Immutability + content addressing | deletes invalidation and the write-routing dimension | prepaid write amplification + garbage collection | the writer and the janitor |
| Declaration (materialized views) | incrementality: the write path can be hooked | coupling; k views means k obligations on the write path | the writer |
| Algebra (monoids, sketches) | delta maintenance and reuse by rollup | exactness | the reader's precision |
| Verification (leases, ETags) | near-coherence | a round trip per read instead of a payload | the reader, cheaply |
| Randomization | removes coordination entirely | slightly more work, weaker worst-case guarantees | diffuse |
| Admission sketches | scan resistance with bounded damage | approximate frequency, one window of pollution | the one-shot traffic |
| Partitioning / pinning | isolation guarantees | utilization | idle capacity |
| Tiering | lower miss time instead of higher hit rate | latency on the miss path; a new coherence boundary | the misses |
| Client near-cache | kills the otherwise unfixable hotspot | a tier you cannot invalidate | staleness |
(A monoid is an operation with a neutral element that can be combined in any grouping, such as sum or max. Aggregates with this property can be maintained from the change alone and rolled up. A materialized view is a stored query result that the database keeps up to date.)
Read the first row against the last. The best move in caching and the worst are the same move: put a copy somewhere the writer cannot reach. The only difference is whether you were able to make the data immutable first.