0
0
LLDsystem_design~12 mins

Notification on state change in LLD - Architecture Diagram

Choose your learning style9 modes available
System Overview - Notification on state change

This system sends notifications to users when the state of an entity changes. It ensures timely updates by detecting state changes, processing them, and delivering notifications via multiple channels like email or SMS.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  v
State Change Service ---> Message Queue ---> Notification Service ---> Notification Channels
                                      |                              |
                                      v                              v
                                  Database                       Cache Layer
Components
User
client
Initiates requests and receives notifications
Load Balancer
load_balancer
Distributes incoming requests evenly to API Gateway instances
API Gateway
api_gateway
Handles client requests, routes them to appropriate services
State Change Service
service
Detects and processes state changes, writes events to message queue
Message Queue
message_queue
Buffers state change events for asynchronous processing
Notification Service
service
Consumes events from queue and sends notifications
Notification Channels
external_service
Delivers notifications via email, SMS, or push
Database
database
Stores state data and notification preferences
Cache Layer
cache
Speeds up access to frequently used data like user preferences
Request Flow - 9 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayState Change Service
State Change ServiceDatabase
State Change ServiceMessage Queue
Notification ServiceMessage Queue
Notification ServiceCache Layer
Notification ServiceNotification Channels
Notification ChannelsUser
Failure Scenario
Component Fails:Message Queue
Impact:Notifications are delayed or lost because events cannot be queued for processing
Mitigation:Use a replicated, durable message queue with retry mechanisms and alerting to restore service quickly
Architecture Quiz - 3 Questions
Test your understanding
Which component ensures that user requests are evenly distributed to prevent overload?
AAPI Gateway
BMessage Queue
CLoad Balancer
DNotification Service
Design Principle
This architecture uses asynchronous messaging to decouple state changes from notification delivery, improving scalability and reliability. Caching user preferences reduces latency, and load balancing ensures even request distribution.