Back to sketch

SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 44

Design global live stock price distribution

Advanced · 40 min · Real-time delivery

A retail investing app shows live prices on watchlists and on each stock's page, for users on phones and browsers in North America, Europe and Asia. Prices come from several exchange feeds. Users want the number on screen to be current and to move when the market moves.

Requirements

  • Show last trade price, change from previous close, and best bid and ask for any of 10,000 listed symbols, updating live while on screen.
  • A watchlist of up to 50 symbols updates live; opening a symbol page shows a correct price immediately, then live updates.
  • A client never shows an older price after a newer one for the same symbol.
  • Show a clear stale indicator when updates for a symbol stop arriving during market hours.

Constraints and assumptions

  • Six exchange feeds totalling 500,000 updates/s at the market open and about 50,000/s on average; the 100 busiest symbols produce 40% of updates.
  • 5M concurrently connected clients at peak across three continents, each subscribed to about 20 symbols.
  • Latency from feed receipt to screen: p99 under 500 ms in the same region, under 1 s worldwide.
  • Display only: no trading on these prices, and nobody can read more than a few changes per second per symbol, so clients do not need every tick.

Out of scope for the first sketch

Order entry and execution · Historical charts · Full order book depth · Options and other derivatives

Draw your design

Rough math and notes

Done on paper? Compare with the worked approaches