← journal·2026-09-12
Websocket Fan-Out at Scale: Lessons From Live Prices
Not financial advice. Verify claims independently.
Live equity quotes are a cruel benchmark for pub/sub. One quiet ticker and your architecture looks fine. Open the tape on the open auction and every assumption about "broadcast" collapses.
The wrong heartbeat
Most tutorials set a 30s ping. Market data clients go dark in under 10s when a NAT middlebox gets bored. We run 4s application heartbeats plus TCP keepalive, and we treat a missed round-trip as a soft reconnect — not a hard drop — so the UI never blanks a book mid-flash.
Symbol sharding
Hash the symbol, not the connection. Connections migrate; symbols don't. Our partitions are stable
across region failovers so a subscriber for AAPL always lands on the same fan-out worker until we
explicitly rebalance.
partition = murmur3(symbol) % N
When N changes, we dual-publish for one TTL window. Expensive for a minute. Free of split-brain forever after.
Backpressure that doesn't lie
Unbounded queues hide outages. Each socket gets a fixed frame budget. When the client lags, we:
- Drop conflatable quotes (keep latest)
- Preserve trades and halts (never conflate)
- Emit a
SLOW_CONSUMERcontrol frame so the SDK can shed UI work
That is the difference between "realtime" and "eventually a screenshot of yesterday."
Where Stock Picks fits
The paper feed on Stock Picks is the same fan-out path — smaller symbol set, identical backpressure. If you are rehearsing infra decisions, start there before you buy another MAU tier from a generic pub/sub vendor.
Put it on a live wire
Stock Picks runs on RT/SOFT — open the paper app and watch the same fan-out path that powers this latency dashboard.
$ open Stock Picks →