System Design Masterclass
E-Commercereal-timestock-marketwebsocketsstreamingpub-subintermediate

Design Real-time Stock Price Viewer

Design a system to display live stock prices to millions of users globally

10M+ concurrent users, 100K+ price updates/sec, sub-100ms latency|Similar to Bloomberg, Yahoo Finance, Robinhood, E*TRADE, Fidelity, Coinbase|45 min read

Summary

Design a system that displays real-time stock prices to millions of concurrent users globally. The core challenge is efficient fan-out - a single price update for AAPL must reach millions of subscribers within milliseconds. We solve this with hierarchical pub/sub, connection aggregation, and smart batching.

Key Takeaways

Core Problem

This is a fan-out problem at extreme scale. One AAPL price update must reach 5M subscribers in under 100ms. Traditional request-response cannot work.

The Hard Part

Hot symbols (AAPL, TSLA, BTC) have millions of subscribers. Naive pub/sub would overwhelm any single server trying to push to all of them.

Scaling Axis

Scale by partitioning subscribers across fan-out servers. Each server handles a subset of connections for each symbol.

The Question: Design a real-time stock price viewer that shows live prices to millions of users worldwide.

This system is essential for: - Trading platforms (Robinhood, E*TRADE) - Users need current prices to make decisions - Financial news (Bloomberg, Yahoo Finance) - Displaying market data - Portfolio trackers - Showing real-time portfolio value - Crypto exchanges (Coinbase) - 24/7 price updates

What to say first

Before I design, let me clarify the requirements. I want to understand the scale, latency requirements, and whether we need to handle trading or just viewing.

Hidden requirements interviewers test: - Do you understand the fan-out challenge? - Can you design for real-time at scale? - Do you know WebSocket connection management? - Can you handle hot keys (popular symbols)?

Premium Content

Sign in to access this content or upgrade for full access.