Tutorials Courses Interview Prep (100 Q&A) AI Tools (50) Developer Tools (50) Tracks Pricing Plans Blog & Articles Contact Us
System Design, Redis & Distributed Systems 10+ Years (Principal / Architect) Expert Production Scenario

How do you design a Real-Time Notification System delivering to 10M concurrent users with WebSockets and Redis Pub/Sub?

Real-World Scenario / Incident Description

A flash notification must be pushed to 10 million active web and mobile users within 3 seconds of a global event announcement.

549 views • Updated 1 month ago

Architectural Blueprint

[Client Socket] ---> [Load Balancer / Nginx] ---> [WebSocket Gateway Cluster (Node/Go/Reverb)]
                                                          ^
                                                          | Redis Pub/Sub Cluster / Kafka
                                                          |
                                                 [Notification Service]

Core Architecture Components:

  1. Stateful Connection Nodes: Gateway instances maintain persistent TCP socket connections and keep a local in-memory lookup map of user_id -> [socket_fd_1, socket_fd_2].
  2. Channel Partitioning in Redis Pub/Sub: Broadcast messages are partitioned by tenant or topic channels (broadcast:global vs user:12345).
  3. Backpressure & Drop Policies: If a client's TCP socket buffer is saturated, drop non-critical status updates to prevent memory exhaustion on the gateway node.
Related Concepts: #WebSockets #Redis Pub/Sub #Kafka #System Design #Scaling