KatInterview

High-Throughput Alert Delivery Pipeline for Spiky Traffic

System DesignModel answer
MediumModel answerSystem Designsystem-designmessage-queuecassandra

Last updated

Design a multi-channel alert delivery platform that survives spikes of roughly one million writes per second, with a justified storage engine and protection against duplicate sends.

You are asked to design a platform that sends alerts to end users (think push, email, SMS and an in-app inbox). Upstream services call it whenever something happens that a user should hear about. At peak, the platform has to accept roughly 1 million writes per second, and that load arrives in bursts, not as a steady stream.

The full requirements list is not provided. Either confirm the assumptions below with your interviewer or state your own, and say why they matter.

Given

  • Peak write rate is about 1 million writes per second and is spiky.
  • Average rate, retention, supported channels and delivery guarantees are unspecified. Ask, or assume and justify.

Questions worth asking

  • What exactly is a "write": an upstream request, a per-recipient record, or a delivery-status update?
  • Which channels are in scope?
  • Is delivery at-least-once with deduplication, or at-most-once? What latency is required, and does it vary by priority?
  • Are there user preferences, quiet hours, rate limits or priority tiers (security alerts versus marketing)?
  • Can users read past notifications, and for how long?
  • What is the peak-to-average ratio, and how long does a burst last?

Part 1: Requirements and scale

List functional and non-functional requirements, estimate throughput, bandwidth and storage from the 1M/s peak, describe the traffic shape, and state which components are sized for peak and which for average.

Part 2: Absorbing bursty writes

Design the ingestion and storage path. Cover a durable partitioned buffer between the API and the workers, partition keys, backpressure, and a data model that avoids hot partitions. If you pick a wide-column store such as Cassandra, explain why its writes are fast and what that costs on the read side.

Part 3: Delivery and deduplication

Design delivery to each channel and ensure a user does not receive the same alert twice when requests or retries are duplicated. Cover idempotency keys, a dedup window and its memory cost, at-least-once processing with idempotent consumers, provider rate limits, retries with backoff, a dead-letter queue, preferences, and priority isolation during bursts.

Hints

Hint 1

Separate acceptance from delivery: the API only needs to durably append the request to a partitioned log and acknowledge, so the burst is absorbed by the log, and workers drain it at a rate downstream providers can tolerate.

Hint 2

A log-structured store turns every write into a commit-log append plus an in-memory table insert, deferring sorting and merging to background flushes and compaction. Think about what that does to read amplification, tombstones and partition design.

Hint 3

You cannot get exactly-once across an external provider, so aim for at-least-once plus idempotency: a deterministic key per (alert, recipient, channel), an atomic set-if-absent check with a TTL, and a durable delivery-state record as the source of truth.