Bird
0
0

How would you design a scalable notification system that handles millions of state changes per second without losing notifications?

hard📝 Trade-off Q9 of 15
LLD - Design — Online Shopping Cart
How would you design a scalable notification system that handles millions of state changes per second without losing notifications?
AUse synchronous direct calls to observers for immediate updates.
BUse asynchronous message queues to decouple state changes from notifications.
CStore all notifications in a database and poll observers periodically.
DUse a single-threaded loop to notify all observers sequentially.
Step-by-Step Solution
Solution:
  1. Step 1: Identify scalability challenges

    Millions of state changes require non-blocking, decoupled notification to avoid delays and loss.
  2. Step 2: Choose asynchronous messaging

    Message queues allow buffering and parallel processing, ensuring reliable delivery at scale.
  3. Final Answer:

    Use asynchronous message queues to decouple state changes from notifications. -> Option B
  4. Quick Check:

    High scale needs async queues [OK]
Quick Trick: Async queues handle high volume notifications [OK]
Common Mistakes:
  • Using synchronous calls causing bottlenecks
  • Polling database causing delays
  • Single-threaded loops blocking notifications

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes