Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a News Subscription Processing Engine

Design a durable engine that manages topic subscriptions and turns each published news item into the correct set of downstream deliveries.

Problem statement

Design a news subscription processing engine around four named operations: newReceived, addSubscription, removeSubscription, and publishNews. For this exercise, assume publisher integrations call newReceived to durably register an immutable news item with a publisher-scoped ID and one or more exact topics.

Subscriber applications use stable subscription IDs to add or remove one exact-topic subscription tied to a durable downstream consumer; a removed ID stays tombstoned and re-subscription uses a new ID. publishNews idempotently commits one accepted item for asynchronous matching and delivery.

A publication uses one immutable cutoff. A subscription removed before the cutoff must not receive that publication, and a subscription added after the cutoff must not receive it; later subscription changes do not rewrite the matched audience.

Commands and workers may retry or race, but one publication creates at most one logical delivery for each matching subscription. Downstream transport is at least once, so every delivery has a stable identity that consumers can deduplicate.

For this exercise, assume ranking, feed-page reads, personalization, full-text search, external article fetching, multi-channel rendering, subscriber billing, and content moderation are outside scope.

Focus on command semantics, subscription authority, matching, fanout, backpressure, failure recovery, and observability.

What to build

  1. For this exercise, a subscriber can idempotently add one stable exact-topic subscription and remove it with a deterministic outcome under retries and races.
  2. For this exercise, a publisher can call newReceived to durably register one immutable news item and recover the same acceptance result after retry or a lost response.
  3. For this exercise, an authorized caller can invoke publishNews once or repeatedly and create one immutable publication whose audience is the subscriptions active at its cutoff.
  4. For this exercise, the engine creates one logical delivery per matching subscription, transports deliveries at least once, and lets operators detect, retry, quarantine, and reconcile incomplete fanout.

At scale

  • For this exercise, assume 10 million subscribers and 50 million active exact-topic subscriptions.
  • For this exercise, assume peaks of 10,000 received news items and 5,000 subscription changes per second; an ordinary item matches hundreds of subscriptions while a hot item can match five million.
  • For this exercise, target 300 milliseconds p95 for healthy command acknowledgement, make 99 percent of ordinary matched delivery records available within 10 seconds, and drain a healthy hot-item fanout within two minutes.
  • For this exercise, keep acknowledged news, subscription changes, publications, and delivery authority durable through a single-zone failure; retain news and delivery evidence for 30 days and make derived topic indexes rebuildable.