Back to roadmap
Module 8 · Caching, Queues, Async WorkDay 06925 min

Caching Layers

Cache at every layer that pays for itself.

Day 069

Caching Layers

Browser
client
CDN
edge
App
service
Redis
cache
DB
datastore
Signal path
Stacked caches
Browser
client
flow
CDN
edge
CDN
edge
flow
App
service
App
service
flow
Redis
cache
Memory hook

Caching Layers: cache at every layer that pays for itself

Mental model

absorb bursts before they become outages

Design lens

Each layer adds invalidation complexity.

Recall anchors
BrowserCDNApp / Redis

Why it matters

Caching layers stack: browser cache, CDN, app cache, distributed cache, DB page cache. Each absorbs load from the next; tuning one reshapes the rest.

Deep dive

Browser: Cache-Control, ServiceWorker.

CDN: 90% byte-shift for static, much more for cached dynamic.

App-level cache: in-process or Redis. Cheap reads, write contention.

DB page cache: free, just give the DB enough RAM.

Demo / scenario

Slow product page (origin 600ms).

  1. Add CDN with 60s cache → most page loads <50ms.
  2. Add app Redis for product details → DB load drops 70%.
  3. Browser SWR shows old data instantly.
  4. End: p95 80ms, DB calm.

Tradeoffs

  • Each layer adds invalidation complexity.
  • Stale data can compound.
  • Hit rates can lie if requests skew to long tail.

Diagram

Browser
CDN
App
Redis
DB
Stacked caches.

Mind map

Check yourself

Loading quiz…

Sources & further reading