Zerodha failed trades at market open
product-rca case · difficulty 4/5 · 20 minutes · banking · India · Zerodha
Prompt
You are a product manager at Zerodha. Failed trades spiked at 9:15 AM, when the market opens, but server CPU and RAM were normal. Find out why.
Context
Order failures are normally under 0.3% at market open. This morning the failure rate rose sharply for the first minute after 9:15. Our own servers show normal CPU and memory. Work the problem as a root-cause analysis: define the metric, structure hypotheses, slice the data, pin the cause, then fix and prevent.
Clarifying questions
- Was it a specific broker API or exchange?
- Failures happen when orders are sent to the exchange gateway. The Kite web and app, login and data feeds work normally.
- How long did it last, and was the market unusual?
- About 45 seconds. Overnight global news caused a very volatile open.
Recommendation
**Root cause:** The upstream exchange gateway rate-limited Zerodha at about 3,000 orders per second after a wave of algorithmic orders at a volatile market open, so excess orders (including manual ones) got 429 rejections. - **Evidence:** 71% of failures are 429s, accepted orders per second plateau at 3,000 while attempts peak at 5,200, failures stop when attempts fall back, and API orders rose from 30% to 52% of a larger base while server CPU and RAM were normal. - **Fix now:** Prioritise manual app orders over API orders in our queue when near the limit, add jittered retries for 429s and show clear 'order queued' messages to users. - **Prevent:** Apply per-client rate limits on the API, agree a higher or more flexible limit with the exchange and plan capacity for known volatile opens, and alert when attempts exceed 80% of the limit. - **Track:** Orders per second, HTTP 429 Too Many Requests, Exchange latency
Risks
- Prioritising manual orders will slow algo traders, a core customer group
- Retries can add more load if not controlled
Next steps
- Review the limit with the exchange and other brokers
- Track orders per second, 429 counts and failed-trade rate at open