Skip to content
StackDecode
System Design
7. Caching ArchitectureAnimated

Cache Hierarchy

Layers of caches from closest to farthest.

The idea

CPU caches, browser, CDN, application cache, database cache. Each layer catches requests before the next.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

CPU registersL1/L2 cacheRAMSSD / networkRemote origin
  • client
  • gateway / proxy
  • service
  • cache
  • data store
  • queue / stream

Each level is bigger, slower and cheaper than the one above.

step:
1/4
at:
CPU registers
1/8

The green dot is a request moving through the system.

Step by step

  1. 1Request checks the browser cache
  2. 2Then the CDN
  3. 3Then the app cache
  4. 4Finally the database

Where it is used

End-to-end performance.

Watch out for

More layers means harder invalidation.

Related