Bird
Raised Fist0
HLDsystem_design~12 mins

Real-time features in HLD - Architecture Diagram

Choose your learning style9 modes available
System Overview - Real-time features

This system enables real-time communication and updates between users and services. It supports instant message delivery, live notifications, and quick data synchronization with minimal delay.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  v
WebSocket Service <--> Message Broker <--> Notification Service
  |                      |
  v                      v
Database <-------------- Cache
Components
User
client
Initiates real-time requests and receives live updates
Load Balancer
load_balancer
Distributes incoming user connections evenly to backend services
API Gateway
api_gateway
Routes requests to appropriate services and handles authentication
WebSocket Service
service
Maintains persistent connections for real-time data exchange
Message Broker
message_queue
Manages asynchronous message delivery between services
Notification Service
service
Processes and sends real-time notifications to users
Database
database
Stores persistent user data and message history
Cache
cache
Stores frequently accessed data to reduce latency
Request Flow - 10 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayWebSocket Service
WebSocket ServiceCache
CacheWebSocket Service
WebSocket ServiceMessage Broker
Message BrokerNotification Service
Notification ServiceDatabase
Notification ServiceWebSocket Service
WebSocket ServiceUser
Failure Scenario
Component Fails:Message Broker
Impact:Real-time message delivery is delayed or lost, notifications do not reach users promptly
Mitigation:Use message broker replication and persistent queues to prevent message loss and enable failover
Architecture Quiz - 3 Questions
Test your understanding
Which component handles persistent connections for real-time data exchange?
AAPI Gateway
BLoad Balancer
CWebSocket Service
DMessage Broker
Design Principle
This architecture uses a combination of persistent WebSocket connections and asynchronous message queues to enable scalable, low-latency real-time features. Caching reduces database load and speeds up data retrieval, while message brokers decouple services for reliability and scalability.