Design a stock broker push notification framework

Design a real-time push notification system for a stock brokerage. An external feed emits { symbol, price, closing_price } events; users subscribe to stocks and must be notified when a price moves ≥5% from closing.

Core pipeline:

  • Ingest events via Kafka (partitioned by symbol for ordering)
  • A threshold filter service computes % change and drops irrelevant events — avoids DB hits per event
  • A subscription lookup service queries user–stock mappings (cache-first, then DB) and fans out to a notification service

Key design considerations:

  • DB choice: PostgreSQL with sharding by symbol (~50K QPS) vs. Cassandra (high write throughput, eventual consistency trade-offs)
  • Notification delivery: at-most-once semantics, idempotency keys to prevent duplicates, Dead Letter Queue for failures
  • Scalability: cache hot subscription data (Redis), partition Kafka by symbol to parallelize fan-out
  • Failure modes: what happens if notification service is down mid-burst?
asked …
LeaderboardSalaryAccount