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:
- 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]. - Channel Partitioning in Redis Pub/Sub: Broadcast messages are partitioned by tenant or topic channels (
broadcast:globalvsuser:12345). - 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
More System Design, Redis & Distributed Systems Interview Questions
How does the Redis Redlock Algorithm provide Fault-Tolerant Distributed Locking across independent Redis nodes?
Read →
Explain the 3 High-Scale Cache Failure Patterns: Cache Avalanche, Cache Breakdown (Dog-Piling), and Cache Penetration, with mitigations.
Read →
Compare Rate Limiting Algorithms: Token Bucket, Leaky Bucket, Fixed Window Counter, and Sliding Window Log/Counter.
Read →
How do you design an Idempotent Payment Processing Architecture with the Saga Pattern across Microservices?
Read →
How does the Circuit Breaker Pattern prevent cascading failures in Microservice architectures?
Read →