PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/System Design/eBay

Design a Top-K trending service

Last updated: May 28, 2026

Quick Overview

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.

  • medium
  • eBay
  • System Design
  • Software Engineer

Design a Top-K trending service

Company: eBay

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Technical Screen

## Scenario You implemented a function to compute “top K” (e.g., most frequent items). Now design a backend service that provides similar functionality at scale. ## Requirements Design a service that continuously computes and serves the **top K most frequent items** (e.g., hashtags, products, search queries). ### Functional requirements - Ingest a high-volume stream of events: each event includes at least `(item_id, timestamp)`. - Support an API to query `GET /topk?k=K&window=...` returning the top-K items by frequency. - Support a time window, at minimum: - Either **all-time** counts, or - A **sliding window** (e.g., last 5 minutes / last 1 hour). State your choice/assumptions. ### Non-functional requirements - Low latency queries (e.g., p95 < 100 ms) at high QPS. - High write throughput ingestion. - Horizontal scalability (add machines to scale). - Fault tolerance and reasonable correctness guarantees (clearly state consistency model). ### Clarifications to address - What are the expected event rate, number of distinct items, and query QPS? - Do you need exact results or are approximate results acceptable?

Quick Answer: 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.

Related Interview Questions

  • Design an Ad Assignment API - eBay (medium)
  • Design a Relational-to-DynamoDB Migration System - eBay (medium)
  • Design an online marketplace for buying and selling - eBay (hard)
  • Handle cache-update conflicts in distributed services - eBay (hard)
eBay logo
eBay
Jan 15, 2026, 12:00 AM
Software Engineer
Technical Screen
System Design
3
0
Loading...

Scenario

You implemented a function to compute “top K” (e.g., most frequent items). Now design a backend service that provides similar functionality at scale.

Requirements

Design a service that continuously computes and serves the top K most frequent items (e.g., hashtags, products, search queries).

Functional requirements

  • Ingest a high-volume stream of events: each event includes at least (item_id, timestamp) .
  • Support an API to query GET /topk?k=K&window=... returning the top-K items by frequency.
  • Support a time window, at minimum:
    • Either all-time counts, or
    • A sliding window (e.g., last 5 minutes / last 1 hour). State your choice/assumptions.

Non-functional requirements

  • Low latency queries (e.g., p95 < 100 ms) at high QPS.
  • High write throughput ingestion.
  • Horizontal scalability (add machines to scale).
  • Fault tolerance and reasonable correctness guarantees (clearly state consistency model).

Clarifications to address

  • What are the expected event rate, number of distinct items, and query QPS?
  • Do you need exact results or are approximate results acceptable?

Solution

Show

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More eBay•More Software Engineer•eBay Software Engineer•eBay System Design•Software Engineer System Design
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.