System Design HLD Example: Notification Service (Email, SMS, Push)
Scenario context
A notification platform routes events to per-channel Kafka queues, deduplicates with Redis, and tracks delivery via webhooks β ensuring that critical alerts like password resets never get blocked by marketing batches.
π― System Scenario & Requirements
System Goal
A notification platform routes events to per-channel Kafka queues, deduplicates with Redis, and tracks delivery via webhooks β ensuring that critical alerts like password resets never get blocked by marketing batches.
Actors & Components
- Application or API tier
- Core service under design
- Operator or SRE observer
Functional Requirements
- A notification platform routes events to per-channel Kafka queues, deduplicates with Redis, and tracks delivery via webhooks β ensuring that critical alerts like password resets never get blocked by marketing batches.
- Uber sends over 1 million push notifications per minute during peak demand β surge pricing alerts, ride status updates, and driver assignments.
- When Twilio (a primary SMS provider) degraded in 2021, U⦠This walkthrough focuses on Notification Service: Use Cases & Requirements .
Constraints & Assumptions
- The source does not isolate a separate failure mode.
- Limits that matter for the scenario are called out in the stage decisions above.
β‘ Execution Stages & Decision Trace
Stage 1 β Stage 1 β Basics: Baseline Architecture
- The baseline approach moves from a synchronous call to an asynchronous pipeline.
- Instead of the "Checkout Service" calling "SendGrid" directly, it calls an internal "Notification Service" which buffers the request.
Deep Dive
Scenario context
A notification platform routes events to per-channel Kafka queues, deduplicates with Redis, and tracks delivery via webhooks β ensuring that critical alerts like password resets never get blocked by marketing batches.
Uber sends over 1 million push notifications per minute during peak demand β surge pricing alerts, ride status updates, and driver assignments. When Twilio (a primary SMS provider) degraded in 2021, Uβ¦
This walkthrough focuses on Scenario context.
Before making a design choice, clarify:
- A notification platform routes events to per-channel Kafka queues, deduplicates with Redis, and tracks delivery via webhooks β ensuring that critical alerts like password resets never get blocked by marketing batches.
- Uber sends over 1 million push notifications per minute during peak demand β surge pricing alerts, ride status updates, and driver assignments.
- When Twilio (a primary SMS provider) degraded in 2021, U⦠This walkthrough focuses on Notification Service: Use Cases & Requirements .
Concepts in play: system-design-hld-architectures, caching, event-driven-architecture, load-balancing
Stage 1 β Stage 1 β Basics: Baseline Architecture
- The baseline approach moves from a synchronous call to an asynchronous pipeline.
- Instead of the "Checkout Service" calling "SendGrid" directly, it calls an internal "Notification Service" which buffers the request.
- Redis performs three roles in the notification service: deduplication key storage (atomic SET NX for idempotency), preference caching (reducing preference DB read load by 10β100Γ), and scheduled notification queuing (β¦
- Applies system-design-hld-architectures to the decision above.
Observable outcome: Applies system-design-hld-architectures to the decision above.
Stage 2 β End-to-end outcome
- After working through the stages, you should be able to explain: - Template Rendering Is a Reliability Risk.
- A template engine processing a Handlebars or Mustache template against a malformed payload can throw an exception and crash the worker.
- A notification service is an asynchronous fan-out platform that decouples internal event producers from unreliable external delivery channels via Kafka-backed per-channel queues.
- Idempotency keys with Redis SET NX prevent duplicate sends when upstream services retry on timeout β this is the most common correctness bug in naive notification systems.
Observable outcome: - - Idempotency keys with Redis SET NX prevent duplicate sends when upstream services retry on timeout β this is the most common correctness bug in naive notification systems.
End-to-end outcome
A notification platform routes events to per-channel Kafka queues, deduplicates with Redis, and tracks delivery via webhooks β ensuring that critical alerts like password resets never get blocked by marketing batches.
Alternatives considered
Alternatives considered
The source focuses on one primary design.
Failure and degraded modes
Failure and degraded modes
- Detection: The source does not isolate a separate failure mode.
- User or operator impact: The source does not isolate a separate failure mode.
Key learnings
- The baseline approach moves from a synchronous call to an asynchronous pipeline.
- After working through the stages, you should be able to explain: - Template Rendering Is a Reliability Risk.
