Skip to content

Caching and CDN

Module 6 of the System Design Masterclass. Every lesson here is free to read, with no account.

  • 8 lessons
  • 3 h of reading
  1. 31Caching basics: hit, miss, TTL, hit rateWhy a cache protects the database, and how to estimate how much it helps with simple arithmetic.24 minCore Fast track
  2. 32Cache-aside, write-through, write-backWho updates the cache when data changes: three ways to do it, what each one costs, and what can go wrong with each.24 minCore Fast track
  3. 33What to throw out: LRU, LFU and cache sizeWhat a cache removes when its memory is full, how the main rules (first in first out, random, least recently used, least frequently used) differ, and how to choose the size of a cache.22 minCore
  4. 34Keeping cached data fresh (invalidation)How old cached data can get, and the ways to keep it fresh: wait for the TTL, delete the entry when the data changes, or change the key. What each way costs and how to measure stale reads.23 minCore
  5. 35When the cache is empty and everyone asks at once (stampede)What happens to the database when the cache is empty or one popular entry expires, and how warm-up, TTL jitter and request coalescing keep the database alive.24 minCore Fast track
  6. 36CDN: serving files from near the userHow a CDN keeps copies of your files in many cities, which files belong there and which do not, how to change a file safely, and how it keeps a sudden crowd away from your own servers.24 minCore
  7. 37Redis beyond a cache: counters, leaderboards, simple locksThree small jobs for Redis besides caching: an atomic counter, a leaderboard with a sorted set, and a lock with a time limit, with the limits of each.12 minCore Fast track
  8. 38Case study: URL shortenerDesign a URL shortener from numbers: estimate the load, make the short code, answer a redirect with a cache and an index, and find the limit where one database is no longer enough.27 minCore · Case study Fast track

The AI tutor is the part you sign up for

Reading is free for everyone. A free account adds the tutor, quizzes, notes and your progress.