Layer 3 · Go deeper · 7 min
Go deeper
Size it, build it, then make the calls an interviewer will push you on.
Back of the envelope
Size it up
Tap through each step of the arithmetic.
How many stale keys can a rare race leave in the cache?
Build-up · 5 steps
Watch a stale set land, then stop it
Delete-after-commit is the right order, and one race still slips through. Follow a slow reader and a writer on one product key.
Step 1 of 5
A reader misses
A reader asks the cache for the samosa price and misses.
4 interview moments
You’re the candidate
The interviewer pushes on the hard parts. Pick an approach and see how it holds up.
Deep dive 1 of 4
Interviewer
“A Big Billion Days-style catalogue is read thousands of times per edit, and a minute of staleness is fine. Which strategy?”
Your move. Pick an approach:
Deep dive 2 of 4
Interviewer
“Product wants debits to feel instant. Someone suggests write-behind for the wallet balance checked before a UPI debit. Do it?”
Your move. Pick an approach:
Deep dive 3 of 4
Interviewer
“Commit-then-delete is in place, but logs show occasional failed deletes and stale pages for minutes. What do you add?”
Your move. Pick an approach:
Deep dive 4 of 4
Interviewer
“Misses read from a database replica. After a price change, the old price keeps reappearing in the cache. Why, and what fixes it?”
Your move. Pick an approach: