KatInterview

Building a Reliable Multi-Channel Alert Pipeline With Safe Retries

System DesignModel answer
MediumModel answerSystem Designsystem-designidempotencyretries

Last updated

Design an alert platform that never silently drops a message, tolerates retries and reordering, and keeps users from seeing repeats across push, email, SMS and in-app channels.

Reliable Alert Delivery Platform

Your company runs many internal services (orders, payments, social features) that need to alert end users through mobile push, email, SMS and an in-app inbox. You are asked to design the shared platform that does this.

Required guarantees

  • Once the platform accepts an alert, it must eventually be delivered or explicitly moved to a failure store. Nothing may vanish silently.
  • Users should not experience duplicates, even though the platform retries internally.
  • A stale alert must not appear after a newer one about the same entity (for example, "Order shipped" must not show up after "Order delivered").

Scale assumptions (adjust if you justify it)

  • About 1 billion users and 10 billion alerts per day, with roughly 5x peak over average.
  • Accept latency in the tens of milliseconds; high-priority delivery within a few seconds at p99.

What to cover

  1. The interface producers use to submit alerts, including how they identify a logical alert so retries are safe.
  2. The interface a channel worker implements, and when it acknowledges a queue message.
  3. Deduplication keys, and at which layers duplicates can enter.
  4. Retry policy with exponential backoff, error classification and terminal handling.
  5. How to cope with out-of-order arrival.
  6. What the user sees: how you keep the experience duplicate-free despite at-least-once internals.
  7. Scaling, storage choices and the main trade-offs.

Hints

Hint 1

Begin by stating what is and is not achievable over unreliable networks and third-party providers. This points you toward at-least-once delivery combined with idempotent handling.

Hint 2

List every place a duplicate can originate: producer retries, queue redelivery, a worker crashing after calling the provider but before recording success, and the client display. Give each its own key or mechanism.

Hint 3

For ordering, attach a monotonically increasing version per entity and keep the highest version already delivered per user and entity, so late arrivals can be recognized and dropped or folded in.