Layer 3 · Go deeper · 9 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 DynamoDB read units for 20,000 reads a second of 3 KB items?
How much load does a 10-second leader window add?
Build-up · 5 steps
Make your own edit stick
A profile edit on a leader with async read replicas. First the bug users report, then the token that fixes it without making the database strong.
Step 1 of 5
Save on the leader
Your phone saves the new bio on the leader, which acknowledges it. Replicas copy it asynchronously, usually well under a second later.
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
“Users say their profile edits vanish on refresh. Reads go to async replicas behind a load balancer. What do you do?”
Your move. Pick an approach:
Deep dive 2 of 4
Interviewer
“A user edits their profile on the phone, then opens the laptop and sees the old one. Do your session tokens help?”
Your move. Pick an approach:
Deep dive 3 of 4
Interviewer
“A flash sale. The product page reads stock from replicas. How do you stop two buyers getting the last unit?”
Your move. Pick an approach:
Deep dive 4 of 4
Interviewer
“Profile reads now carry LSN tokens, yet users still see old bios. There’s a cache in front. What’s going on?”
Your move. Pick an approach:
Build-up · 4 steps
Pick the weakest level that’s safe
For each read path, ask what a stale or reordered read would break. Start at the top and stop at the first yes.
Step 1 of 4
Breaks an invariant?
If a stale or reordered read could lose money or stock, or hand out a name twice, you need linearizable, via consensus or a leader with compare-and-set.