Skip to content
Preptima
hardDesignMidSeniorStaff

Where do you put the cache, and how big does it need to be?

6 min readUpdated 2026-08-15

Answer

Short answer

Choose the layer by who else can reuse the same bytes and how tolerable staleness is that far from the user, then size it from the working set rather than the dataset. Watch the miss rate, not the hit rate: origin load is proportional to misses, so 99 percent falling to 95 is a fivefold traffic increase.

Was this answer helpful?

Likely follow-ups

  • Your hit rate is 97 percent and the origin is still saturated. What would you look at first?
  • When is a validation request with an ETag better than a longer max-age?
  • You add a 30-second local cache in front of the shared cache. What did you just make worse?
  • How would you cache a response that differs per user without duplicating it per user?

Related questions

Further reading