← eBay Interview Insights

eBay·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
May 2026

Summary

eBay system design round, one big question that kept branching into sub-problems. Started with a single-machine setup and they kept pushing until we were talking about distributed merging and failure recovery. Felt like I was barely keeping up by the end.

Questions Asked (1)

Q1

Design a distributed service that tracks and returns the top-K most frequent items over a high-throughput event stream. Walk through the full system: API design, ingestion pipeline, approximate counting with sketches, sharding and merging across nodes, time-window semantics, and how it scales.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

This was basically the whole interview.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (throughput, latency, accuracy, time windows) and then present a high-level architecture that separates ingestion, counting, and query layers. Dive into the core algorithm (e.g., Count-Min Sketch with a min-heap for top-K) and explain how sharding and merging work across nodes. Conclude with scaling strategies and trade-offs.

Pro tip: Emphasize that approximate counting with sketches is a deliberate trade-off for scalability, and discuss how to handle time windows by using multiple sketches with epoch-based rotation. This shows you understand both the algorithmic and operational aspects.

1. Clarify Requirements and Scope

Ask about event rate, item cardinality, desired accuracy, latency, and time window semantics (e.g., sliding vs. tumbling). This ensures the design meets the actual needs.

2. High-Level Architecture

Outline the components: ingestion layer (e.g., Kafka), stream processing (e.g., Flink/Spark Streaming), distributed counting nodes, and a query API. Explain data flow from ingestion to query.

3. Core Algorithm: Approximate Counting

Describe using a Count-Min Sketch for frequency estimation and a min-heap of size K to track top items. Discuss error bounds and how to merge sketches across shards.

4. Sharding and Merging

Explain how to partition the stream by item hash to distribute load. Each shard maintains its own sketch and heap; a query merges results by summing sketches and merging heaps.

5. Time Windows and Scaling

Discuss time-window semantics: use multiple sketches for different windows (e.g., last 1 min, 5 min) with rotation. Scale by adding shards and using a distributed query layer that aggregates results.

Key Points to Mention

  • Count-Min Sketch parameters (width, depth) and error guarantees
  • Min-heap for top-K with efficient updates
  • Sharding by item key to distribute load and enable parallel processing
  • Merging sketches by element-wise addition and merging heaps
  • Time window handling via epoch-based rotation or sliding windows
  • Trade-offs: accuracy vs. memory, latency vs. consistency, and fault tolerance

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.