Skip to content
StackDecode
System Design
7. Caching ArchitectureAnimated

Cache Performance Optimisation

Raising hit rate and cutting latency.

The idea

Tune sizes, TTLs, key design and eviction, and measure hit rate and latency.

Watch it work

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

request streamABFBFADADADFAADAACBDAFcache (4 slots)Alast use 1MISS A is fetched from the databasehit rate 0% (0 of 1)
  • hit
  • current request

A is missing: fetch it from the database and store it.

step:
1
hits:
0
1/22

Eviction policy: least recently used.

Step by step

  1. 1Measure hit rate
  2. 2Find popular keys
  3. 3Tune TTL and size
  4. 4Re-measure

Where it is used

Cost and latency tuning.

Watch out for

A high hit rate on unimportant data is not a win.

Related