Bird
Raised Fist0
HLDsystem_design~20 mins

Notification system design in HLD - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Notification System Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Architecture
intermediate
2:00remaining
Identify the correct component for handling user preferences in a notification system

In a notification system, users can choose how they want to receive notifications (email, SMS, push). Which component is best suited to manage these preferences?

ANotification Dispatcher
BMessage Queue
CNotification Logger
DUser Preference Service
Attempts:
2 left
💡 Hint

Think about where user choices are stored and accessed before sending notifications.

scaling
intermediate
2:00remaining
Scaling the notification delivery to millions of users

You need to design a notification system that can send push notifications to 10 million users simultaneously. Which approach best supports this scale?

AUse a distributed message queue with multiple worker services sending notifications in parallel
BUse a single server to send all notifications sequentially
CSend notifications directly from the database triggers
DStore notifications in a file and send them manually
Attempts:
2 left
💡 Hint

Consider how to handle large volumes efficiently and avoid bottlenecks.

tradeoff
advanced
2:00remaining
Choosing between push and pull notification models

Which is a key tradeoff when choosing between push and pull notification delivery models?

APush notifications require clients to request updates; pull notifications send updates automatically
BPush notifications reduce server load but increase client battery usage; pull notifications increase server load but save client battery
CPush notifications are slower than pull notifications in delivering messages
DPull notifications cannot be used for mobile devices
Attempts:
2 left
💡 Hint

Think about who initiates the communication and resource usage on client and server.

🧠 Conceptual
advanced
2:00remaining
Ensuring message ordering in a distributed notification system

In a distributed notification system, what is the best way to ensure notifications are delivered to a user in the order they were generated?

ASend notifications from multiple servers without coordination
BStore notifications in a database without timestamps
CUse a single partitioned message queue per user to preserve order
DDeliver notifications randomly to reduce latency
Attempts:
2 left
💡 Hint

Think about how message queues can preserve order per user.

estimation
expert
2:00remaining
Estimating storage needs for notification logs

Your notification system logs every notification sent. Each log entry is 1 KB. If you send 1 million notifications per day and keep logs for 90 days, how much storage do you need?

AApproximately 90 GB
BApproximately 9 GB
CApproximately 900 GB
DApproximately 9000 GB
Attempts:
2 left
💡 Hint

Calculate total entries times size per entry.

Practice

(1/5)
1. Which component in a notification system is primarily responsible for storing user preferences about how they want to receive notifications?
easy
A. User Management Service
B. Notification Delivery Service
C. Notification Queue
D. Notification Generator

Solution

  1. Step 1: Understand user preferences role

    User preferences define how users want to receive notifications (email, SMS, push).
  2. Step 2: Identify responsible component

    The User Management Service stores and manages user data including preferences.
  3. Final Answer:

    User Management Service -> Option A
  4. Quick Check:

    User preferences stored in User Management Service [OK]
Hint: User preferences belong to user data, so User Management Service [OK]
Common Mistakes:
  • Confusing Notification Queue as storage for preferences
  • Thinking Notification Delivery Service stores preferences
  • Assuming Notification Generator manages user data
2. Which of the following is the correct sequence of components involved in sending a notification from creation to delivery?
easy
A. User Management Service -> Notification Delivery Service -> Notification Generator
B. Notification Delivery Service -> Notification Queue -> Notification Generator
C. Notification Queue -> Notification Generator -> Notification Delivery Service
D. Notification Generator -> Notification Queue -> Notification Delivery Service

Solution

  1. Step 1: Understand notification flow

    Notifications are created, queued, then delivered.
  2. Step 2: Match correct order

    Notification Generator creates, Notification Queue holds, Delivery Service sends.
  3. Final Answer:

    Notification Generator -> Notification Queue -> Notification Delivery Service -> Option D
  4. Quick Check:

    Creation, queue, delivery order = A [OK]
Hint: Notifications flow: create, queue, then deliver [OK]
Common Mistakes:
  • Mixing delivery before queuing
  • Starting with delivery service instead of generator
  • Ignoring the queue component
3. Consider this simplified flow: A notification is created and placed in a queue. The delivery service fetches notifications from the queue and sends them. If the delivery service crashes after fetching but before sending, what happens to the notification?
medium
A. Notification is lost and never sent
B. Notification is duplicated and sent twice
C. Notification remains in the queue for retry
D. Notification is sent immediately by the generator

Solution

  1. Step 1: Analyze delivery service crash timing

    Crash occurs after fetching from queue but before sending notification.
  2. Step 2: Understand queue behavior with acknowledgment

    Without acknowledgment, message stays or returns to queue for retry.
  3. Final Answer:

    Notification remains in the queue for retry -> Option C
  4. Quick Check:

    Unacknowledged messages stay in queue [OK]
Hint: Unsent messages stay in queue until confirmed sent [OK]
Common Mistakes:
  • Assuming notification is lost without retry
  • Thinking notification is duplicated automatically
  • Believing generator sends notification directly
4. A notification system is experiencing delays because the delivery service processes notifications sequentially. Which change will best improve throughput without losing message order?
medium
A. Store notifications only in the database without queue
B. Add multiple delivery service instances with partitioned queues
C. Use a single-threaded delivery service with longer timeouts
D. Remove the queue and send notifications directly

Solution

  1. Step 1: Identify bottleneck cause

    Sequential processing limits throughput.
  2. Step 2: Apply partitioned queues with multiple instances

    Partitioning allows parallel processing while preserving order per partition.
  3. Final Answer:

    Add multiple delivery service instances with partitioned queues -> Option B
  4. Quick Check:

    Parallelism with partitioning improves throughput [OK]
Hint: Partition queues to parallelize delivery without breaking order [OK]
Common Mistakes:
  • Removing queue loses reliability and order
  • Single-threaded service slows throughput
  • Storing only in DB delays delivery
5. You need to design a notification system that supports millions of users with different notification preferences and guarantees delivery within seconds. Which architectural approach best meets these requirements?
hard
A. Implement microservices with separate components for user preferences, notification generation, queuing, and delivery with horizontal scaling
B. Use a monolithic service handling all notifications synchronously
C. Store all notifications in a single database table and poll it every minute for delivery
D. Send notifications directly from the user management service without queues

Solution

  1. Step 1: Analyze scalability and latency needs

    Millions of users and seconds-level delivery require scalable, decoupled design.
  2. Step 2: Choose microservices with separate components and horizontal scaling

    This approach allows independent scaling, fault isolation, and faster processing.
  3. Final Answer:

    Implement microservices with separate components for user preferences, notification generation, queuing, and delivery with horizontal scaling -> Option A
  4. Quick Check:

    Microservices + scaling = scalable, fast delivery [OK]
Hint: Decouple components and scale horizontally for millions of users [OK]
Common Mistakes:
  • Using monolith limits scalability and speed
  • Polling DB every minute causes delays
  • Skipping queues reduces reliability