This question evaluates skills in distributed system design, real-time stream processing, scalable aggregation, windowing semantics, and trade-offs around latency, accuracy, and fault tolerance when computing top-K frequencies.
You implemented a function to compute “top K” (e.g., most frequent items). Now design a backend service that provides similar functionality at scale.
Design a service that continuously computes and serves the top K most frequent items (e.g., hashtags, products, search queries).
(item_id, timestamp)
.
GET /topk?k=K&window=...
returning the top-K items by frequency.