Last Minute Notes
  • Github
  • Docs
  • Learn
    @sayanstwt
Lessons
0/37 done
  • DNS Resolution
  • Content Delivery Networks
  • Load Balancing
  • Gateways, Proxies & Meshes
  • Caching
  • Rate Limiting
Learn/System Design/Traffic & Edge

Caching

9 min Intermediate 6 steps

Cache-aside, write patterns, eviction and the stampede problem.

Result
no cache
Latency
~40 ms
DB reads
1
CacheRedisClientServiceDatabaseCPU 95%GET /u/7SELECTrowsame query, again and again
request response data
In this lessonStep 1 of 6
  1. The problem
  2. Cache-aside
  3. Writes
  4. Write modes
  5. Stampede
  6. Recap
Step 1 / 6problem

Every read hits the database

A popular page asks the database the same question thousands of times a second.

The database is the slowest and most expensive part of the path, so it becomes the bottleneck first.

Key idea

A cache stores the result of expensive work so the next request is cheap. It is the highest leverage tool for read-heavy systems.

←→ step·R replay·Space pause

You'll learn

  • Run the cache-aside read and write paths
  • Why writes delete the key instead of updating it
  • Compare write-through and write-behind
  • Spot and fix the stampede
Read the full notesHLD Building Blocks, 6