Design a Real Time Market Data WebSocket Feed
Last updated: November 29, 2026
Quick Overview
Design the service that streams order book updates, trades and candles for hundreds of trading pairs to hundreds of thousands of WebSocket clients, from retail apps to latency-sensitive market makers, with consistent snapshots and gap recovery.
Gemini
November 29, 20260
0
0 solved
Design the service that streams order book updates, trades and candles for hundreds of trading pairs to hundreds of thousands of WebSocket clients, from retail apps to latency-sensitive market makers, with consistent snapshots and gap recovery.
Gemini serves public market data over WebSocket APIs (served from AWS Local Zones close to its New York trading system) as well as to its own web and mobile apps. The interviewer looks for a clean split between the matching engine and fan-out, sequence numbers for correctness, and handling of slow consumers during volatility spikes.
What the Interviewer Expects
- Decouple the engine from fan-out with an ordered per-symbol event log
- Use sequence numbers plus snapshots so clients can detect and repair gaps
- Handle slow consumers without slowing others (bounded buffers, conflation, disconnect)
- Offer different products for different clients: full depth, top N, conflated retail feed
- Plan capacity for 10x bursts on big price moves
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How would you guarantee a client never sees a snapshot that is older than an update it already applied?
- How do you serve a mobile client on a weak connection without hurting market makers?
- What would you change to give co-located clients lower latency than internet clients?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: subscribe to symbols and channels (L2 updates, trades, candles); receive an initial snapshot then incremental updates; detect gaps. Non-functional: engine output to client p99 in low milli...
High-Level Design
Matching engine emits an ordered stream per symbol with a monotonically increasing seq into a log (Kafka-style or an in-house multicast). Book builders consume it and maintain the current book p...