Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 04 · System Design · The parts, properly · about 24 min to read

Watch: Caching properly: write strategies, stampedes, and invalidation
▶ VideoPlay it as a journeyTutor comes with a plan

The Slate, Properly (caching to real depth)

The Slate, Properly
The Slate, Properly · Open board

The slate drawn again with the engineering on it: what a copy is worth, what makes it lie, and the failure that takes the stall down.

Before you start. You need one picture from The slate next to the stove (caching): the chai stall chalks the day’s prices on a slate by the stove, so nobody walks to the register in the back room for an answer somebody already fetched. That is the whole background. The rest is a programmer at LiveJournal in 2003, a team at Facebook in 2013, one table you add up by hand, and a failure that strikes when everything is going well.

Lesson 20 of 115 in System Design

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 2003: spare RAM, a dying database, and hardware that had not arrived
  • The hit rate: the share of asks the slate answers by itself
  • Invalidation: throwing a line away once it has started lying
  • 2013: the stampede, when one blank line sends everyone to the register at once
  • Single-flight: one person walks, everyone else waits at the door
  • Eviction: the slate is full, so a line has to be erased
  • The other stampede fixes, and which failure each actually fixes
  • Eviction beyond LRU, and the table behind the story
  • What to cache, and the keys

Terms it explains: cache, hit rate, invalidation, TTL, stampede, Single-flight, eviction, LRU, where, read, write, thrown away, Valkey, stale-while-revalidate, one hot key expiring, TTL jitter, Probabilistic early expiration, cache penetration, LFU, ARC, Capacity dominates, halve.

Related paper

Review System Design