Concurrency & payments · Production incident
One left, two sold
Two customers buy the last item at the same moment and both orders succeed. How do you stop stock being sold twice?
Saturday 11:05 · checkout-serviceIllustrative scenario, not a real incident
Warehouse: 37 orders from this morning's sale cannot be shipped, because the items are not there
A sale opened at 10:00. By 10:20 several popular items showed a stock level below zero, and orders for them were still being confirmed.
The checkout service runs on six instances behind a load balancer. Stock lives in one PostgreSQL table, one row per item. Outside the sale, the numbers have always added up.
What the dashboards and logs show
- Stock levels
- 9 items below zero, the lowest at -11
- Orders confirmed
- 37 more than the stock that existed
- Checkout rate
- about 400 a second at the peak, 20 on a normal day
- Errors
- none: every one of these orders returned 200
Clarify · optional · scored under "Hypothesis before change"
Ask the interviewer
0 of 3 asked
Each question reveals a fact. What you ask before you act is part of your score.
First move · scored under "Mitigate before root cause"
The sale is still running and still overselling. What do you do first?
Your rubric score, the model answer, the follow-up questions and the related lessons appear once you have answered the last step.