Intermediate LevelSystem Design & Architecture
How do you design a real-time Chat Application (like WhatsApp or Slack)?
β Interview Prompt: Explain designing a Chat Application, WebSockets connection gateway, message status tracking (sent, delivered, read), and NoSQL message history storage.
Designing a high-concurrency real-time Chat Application (WhatsApp/Slack):
Core Architecture:
1
Connection Gateway: Manages millions of long-lived WebSocket connections across server clusters.
2
Presence & Routing: Tracks online status in Redis ('user:100 -> gateway_node_3'). Directs messages to active WebSockets or pushes notifications for offline users.
3
Message History: Stores chat messages in an append-only NoSQL database (Cassandra / HBase) partitioned by 'chat_id'.
Code Implementation Example
markdown
Real-Time Chat App Architecture:
[Sender Client] ββ(WebSocket)ββ> [WS Gateway Node 1]
β
(Lookup Recipient WS Node)
β
βΌ
[Receiver Client] <ββ(WebSocket)ββ [WS Gateway Node 2]
β
(Persist Message)
βΌ
[Cassandra Message DB]π‘Real-Time Chat Application architecture using WebSocket gateways and Cassandra.
π― Interview Key Takeaway
Design chat applications using WebSocket connection gateways, Redis presence tracking, and Cassandra message history.
#System Design#Chat Application#WebSockets#Cassandra#Intermediate
Back to all System Design & Architecture Questionsβ