Skip to content
StackDecode
System Design
7. Caching ArchitectureAnimated

Multi-Level Caching

Local cache in front of a shared cache.

The idea

A fast in-process cache catches the hottest keys, then a shared cache, then the database.

Watch it work

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

RequestL1 in-processL2 RedisDatabase
  • client
  • gateway / proxy
  • service
  • cache
  • data store
  • queue / stream

Check the in-process cache: nanoseconds.

step:
1/4
at:
Request
1/10

The green dot is a request moving through the system.

Step by step

  1. 1Check local memory
  2. 2Then the shared cache
  3. 3Then the database
  4. 4Populate each level on the way back

Where it is used

High-traffic systems.

Watch out for

Local copies may be briefly stale.

Related