Layer 3 · Go deeper · 6 min
Go deeper
Size it, build it, then make the calls an interviewer will push you on.
Build-up · 5 steps
Watch a ₹200 top-up vanish
Two ₹200 credits to a ₹500 wallet, each written as read-modify-write. Time runs down the page; watch the gap between B’s read and its write.
Step 1 of 5
One row, two credits
The wallets row holds ₹500. A ₹200 top-up (A) and a ₹200 cashback (B) arrive together, so the only right answer is ₹900.
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
“Flash sale. One phone left, and many buyers hit that SKU in the same second. How do you decrement stock?”
Your move. Pick an approach:
Deep dive 2 of 4
Interviewer
“Priya and Arjun both open support ticket #8812 and edit for minutes. How do you stop one save silently erasing the other?”
Your move. Pick an approach:
Deep dive 3 of 4
Interviewer
“A Django view does
reporter.stories_filed += 1; reporter.save(). Under load the count drifts low. What do you change?”Your move. Pick an approach:
Deep dive 4 of 4
Interviewer
“Some wallet balances are off by exactly ₹200. The logs show no errors. What do you do?”
Your move. Pick an approach:
Build-up · 4 steps
Three fixes, three places B learns
The same two ₹200 credits to a ₹500 wallet, replayed under the first three fixes. Every panel ends at ₹900; what differs is how B finds out about A.
Step 1 of 4
Atomic UPDATE: B queues
Both send balance = balance + 200. B waits for A’s row lock, then adds to the newest row, so ₹700 becomes ₹900. No read, no retry.