Concurrency & payments · Design under changing requirements
One limit, six gateways
A payments API runs on many gateway instances and promises 100 requests a second per API key. How do you enforce that limit?
Tuesday 10:15 · payments-gateway, design reviewIllustrative scenario, not a real incident
A batch job on one API key was admitted at about 450 requests a second. The contract says 100
The payments API promises each API key 100 requests a second, and answers anything above that with a 429. Six gateway instances behind a load balancer enforce the limit.
Yesterday one merchant's batch job sent 1,500 requests a second for 90 seconds. About 450 a second were let through, and the card processor began refusing that merchant's payments.
What the dashboards and logs show
- Contract
- 100 requests a second per API key, 429 above that
- Gateway
- 6 instances behind one load balancer
- Batch job
- 1,500 requests a second for 90 seconds, one API key
- Let through
- about 450 a second
- Time the limiter may add
- 2 ms per request at p99
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 batch job runs again tonight, and a new limiter is weeks away. 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.