Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Streaming Top-K Hitters System

Continuously rank the most frequent keys over recent and all-time windows.

Problem statement

For this exercise, assume you are designing a streaming top-k hitters system. Continuously rank the most frequent keys over recent and all-time windows. Define a coherent first production version that satisfies the listed requirements and scale while making failures and degraded behavior visible.

What to build

  1. Accept high-volume key-hit events with event timestamps and idempotency identifiers.
  2. Return top K for configured windows and dimensions with counts and freshness.
  3. Handle late events, hot keys, and replay without double counting.

At scale

  • For this exercise, assume five million hits per second and one billion distinct keys per day.
  • Serve top-100 queries within 500 ms p99 and refresh results every five seconds.
  • Support windows from one minute through 30 days.