This question evaluates a candidate's competency in designing scalable, low-latency streaming data systems, covering event-time windowing, rolling-window aggregation, idempotency for duplicate events, late/out-of-order handling, and auditability.
Design a service that ingests donations and serves rolling 3-day donation totals.
donation_id
(unique),
user_id
,
campaign_id
,
amount
,
currency
,
created_at
(event time).
GET /campaigns/{id}/total?window=72h
→ total donated to that campaign in the last 72 hours (rolling window).
GET /leaderboard?window=72h&k=100
→ top-K campaigns by donated amount in the last 72 hours.
created_at
), not ingestion time.