Bird
Raised Fist0
HLDsystem_design~7 mins

Design a notification system in HLD - System Design Guide

Choose your learning style9 modes available
Problem Statement
When a system needs to inform users about events or updates, sending notifications directly from the main application can cause delays and failures under high load. Without a dedicated notification system, messages may be lost, delayed, or overwhelm the service, leading to poor user experience and missed critical alerts.
Solution
A notification system decouples message creation from delivery by using queues and workers. It collects notification requests, stores them temporarily, and processes them asynchronously to send via multiple channels like email, SMS, or push notifications. This ensures reliable, scalable, and timely delivery without blocking the main application.
Architecture
Application
Service
Notification

This diagram shows the flow where the application service sends notification requests to a queue. Notification workers consume from the queue and send messages through external channels like email, SMS, or push notification services.

Trade-offs
✓ Pros
Improves system responsiveness by offloading notification sending to asynchronous workers.
Increases reliability with retry mechanisms and durable queues to prevent message loss.
Supports multiple notification channels and easy extensibility for new types.
Scales horizontally by adding more workers to handle increased notification volume.
✗ Cons
Adds architectural complexity with additional components like queues and workers.
Introduces eventual consistency; notifications may be delayed under heavy load.
Requires careful handling of failure scenarios and duplicate message prevention.
Use when your system needs to send notifications to many users or multiple channels, especially if notification volume exceeds hundreds per second or when user experience depends on timely alerts.
Avoid if your application sends very few notifications (under 10 per minute) or if immediate, synchronous notification is critical and system load is low.
Real World Examples
Uber
Uber uses a notification system to asynchronously send ride status updates and promotions via SMS and push notifications without blocking core ride matching services.
Amazon
Amazon employs notification queues to reliably send order confirmations and shipping alerts through email and SMS, ensuring messages are not lost during peak shopping times.
LinkedIn
LinkedIn uses a notification system to deliver connection requests, messages, and job alerts across multiple channels, scaling to millions of users daily.
Alternatives
Synchronous Notification
Notifications are sent immediately within the main request flow without queuing or asynchronous processing.
Use when: Choose when notification volume is very low and immediate delivery is required without added system complexity.
Push Notification Service
Uses third-party push services directly without internal queuing or worker management.
Use when: Choose when relying on external providers for notification delivery and when internal control or customization is minimal.
Summary
A notification system prevents delays and failures by decoupling message sending from the main application.
It uses queues and workers to asynchronously deliver notifications via multiple channels reliably and at scale.
This design improves user experience and system resilience but adds complexity and eventual consistency.