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.
When do optimistic retries blow up?
100,000 taps in a minute for 500 berths. How bad is one row?
How far do split stock and a per-item queue raise the ceiling?
Build-up · 6 steps
From one conditional write to a flash sale
Start with the rung most designs never leave, then add one escalation per step as the item gets slower to pay for and hotter to claim.
Step 1 of 6
One conditional write
The API claims with UPDATE … WHERE status = 'free' and checks the row count. One row changed means yours; zero means taken. Most designs stop here.
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
“Thousands of users pick seats for one show. How does your service claim seat C7?”
Your move. Pick an approach:
Deep dive 2 of 4
Interviewer
“A limited-stock counter takes 2,000 writes a second at peak. A teammate proposes version checks with retries. Your call?”
Your move. Pick an approach:
Deep dive 3 of 4
Interviewer
“Users pay by UPI collect or card OTP, which can take minutes. How do you keep the seat for them?”
Your move. Pick an approach:
Deep dive 4 of 4
Interviewer
“A supplier’s inventory API has no compare-and-set, so a teammate guards it with a Redis lock that expires after 30 s. Is that safe?”
Your move. Pick an approach: