Preparing your design workspace

Loading the problem and your latest saved attempt…

Design Top-K News Articles in a Time Window

Rank the most-viewed news articles for a requested historical time window at large scale.

Problem statement

For this exercise, assume you are designing top-k news articles in a time window. Rank the most-viewed news articles for a requested historical time window at large scale.

Keep ingestion and ranking usable when one article becomes a hot key, then define a coherent first production version that satisfies the listed requirements and scale while making failures and degraded behavior visible.

What to build

  1. Ingest deduplicated article-view events with article and event-time metadata.
  2. Return top K articles for an arbitrary requested window and optional market or category filters.
  3. Expose freshness and exact-versus-approximate result guarantees.
  4. Keep ingestion and ranking available under severely skewed traffic, including a viral article that becomes a hot key, without silently changing the advertised exact or approximate guarantee.

At scale

  • For this exercise, assume two million view events per second, 100,000 top-K queries per second, and 50 million active articles.
  • Support windows from five minutes through 30 days with two-second p95 queries.
  • Late events may arrive up to 24 hours after their event time.