Read-through cache layer

DesignMedium40 minAmazon and Shopify style

Your task

Design a read-through cache layer sitting between an API tier and a primary database for a product-catalog service. Traffic: ~120K reads/sec, ~2K writes/sec (95% reads), data is ~80% read-mostly product records but ~20% has frequent price/inventory updates. Requirements: cache reads to cut DB load by 10x+, keep cached data fresh within seconds of a write, survive a cache-node failure without overwhelming the DB, and avoid serving wildly stale prices. p99 read latency target <15ms.

It covers

  • Caching
  • Read through
  • Invalidation
  • Stampede