← Uber Interview Insights

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

SeniorPrefer not to say
Jul 2026

Summary

Uber onsite system design round focused on a top-K popular items service, the kind of prompt that keeps showing up across Uber Eats and search teams. Dense round with a lot of follow-ups on windowing, hot keys, and API design.

Questions Asked (6)

Q1

Design a service that returns the top-K most popular items over a rolling time window, supporting per-restaurant, per-city, and global query slices at over a million events per second.

System DesignTechnical Trade-offs
Author's notes

This is the core prompt and it's deceptively broad.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a high-level architecture that separates ingestion, aggregation, and query layers. Focus on how to handle high throughput with approximate algorithms and efficient data structures, and discuss trade-offs between accuracy, latency, and cost.

Pro tip: Emphasize that exact top-K over sliding windows at this scale is impractical; instead, propose approximate counting with error bounds and explain how to tune accuracy vs. resource usage. Also, mention the importance of idempotency and exactly-once processing in the ingestion pipeline.

1. Clarify Requirements and Scale

Ask about event types, window sizes (e.g., 1 min, 5 min, 1 hour), query latency SLAs, and accuracy requirements. Confirm the need for per-restaurant, per-city, and global slices.

2. Design Ingestion Pipeline

Propose a scalable ingestion layer using a distributed message queue (e.g., Kafka) to handle 1M+ events/sec. Discuss partitioning by restaurant/city to enable parallel processing.

3. Choose Aggregation Strategy

Use stream processing (e.g., Flink, Spark Streaming) with approximate algorithms like Count-Min Sketch or Space-Saving for top-K. Maintain sliding windows via time-based buckets or exponential decay.

4. Design Storage and Query Layer

Store aggregated sketches in a low-latency store (e.g., Redis, Cassandra) keyed by slice and window. Serve queries by merging sketches or precomputing top-K per slice.

5. Address Trade-offs and Optimizations

Discuss accuracy vs. memory, window granularity, and cost. Mention techniques like hierarchical aggregation (restaurant -> city -> global) and caching hot queries.

Key Points to Mention

  • Use of approximate counting algorithms (Count-Min Sketch, Space-Saving) for memory efficiency and speed.
  • Sliding window implementation via bucketed time intervals or exponential decay to avoid recomputation.
  • Partitioning strategy to parallelize ingestion and aggregation by restaurant/city.
  • Hierarchical aggregation to derive city and global top-K from per-restaurant data, reducing duplication.
  • Trade-offs between exact vs. approximate results, and how to tune error bounds.
  • Handling late/out-of-order events with watermarks or allowed lateness in stream processing.

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

Q2

How would you implement the sliding window mechanics efficiently without scanning raw events on every query?

System DesignAlgorithms & Data Structures
Author's notes

Minute-grain tumbling buckets plus a rolling sum over the last N buckets.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements: what is the sliding window (e.g., time-based, count-based), what queries are expected (e.g., count, sum, average), and the scale (events per second, window size). Then propose a pre-aggregation strategy: maintain incremental aggregates (e.g., counts, sums) in a data structure like a ring buffer or time-bucketed store, so queries can be answered in O(1) or O(log n) without scanning raw events. Finally, discuss trade-offs and optimizations for high throughput and low latency.

Pro tip: Emphasize that the key is to decouple event ingestion from query processing by maintaining a materialized view of the window, and mention how you would handle out-of-order events and late data to show depth.

1. Clarify requirements and constraints

Ask about the window type (time-based, count-based), query patterns (e.g., count, sum, distinct), expected throughput, latency requirements, and whether events can be out-of-order or late.

2. Choose a pre-aggregation strategy

Decide on a data structure to maintain incremental aggregates, such as a ring buffer for fixed-size windows, time-bucketed counters for time-based windows, or a balanced tree for sliding windows with arbitrary ranges.

3. Design update and query paths

On each event, update the aggregate in O(1) or O(log n) by adding to the current bucket and removing expired data. For queries, combine pre-aggregated values (e.g., sum over buckets) without scanning raw events.

4. Handle edge cases and optimizations

Address out-of-order events by using event time and watermarks, handle late data with allowed lateness or side outputs, and optimize for high concurrency with sharding or lock-free structures.

5. Discuss trade-offs and alternatives

Compare with other approaches like streaming frameworks (Flink, Kafka Streams) or approximate algorithms (sketches) for high cardinality, and explain when to use each based on accuracy, memory, and complexity.

Key Points to Mention

  • Time-bucketed aggregation with sliding window using circular buffer or timestamp-indexed buckets
  • Incremental updates: add new event, subtract expired event (for sum/count) to maintain O(1) query
  • Handling out-of-order events with watermarks and allowed lateness
  • Use of efficient data structures like Fenwick tree (BIT) for range sum queries in sliding window
  • Sharding and parallelism to scale updates and queries
  • Trade-offs between exact and approximate (e.g., HyperLogLog for distinct count) and memory vs. accuracy

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

Q3

How do you handle a 'hot key' situation where a viral item in one city overwhelms a single shard?

System DesignTechnical Trade-offs
Author's notes

Key-prefix sharding with a random suffix, then merge on the client side.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the scenario: a hot key is a single item (e.g., a restaurant, event, or driver) receiving a massive, localized spike in traffic that overwhelms a single shard. Then propose a multi-layered mitigation strategy that includes immediate relief (caching, rate limiting) and longer-term architectural changes (sharding by key, replication, load shedding).

Pro tip: Emphasize that hot keys are a data distribution problem, not just a scaling problem—show you understand the trade-offs between consistency, latency, and cost when applying solutions like key splitting or local caching.

1. Clarify and Define the Hot Key Scenario

Ask clarifying questions to understand the scale, access pattern (read vs. write), and business impact. Define what 'overwhelms' means (e.g., CPU, memory, network) and the expected SLAs.

2. Immediate Mitigation Tactics

Propose short-term fixes like caching the hot item at the edge or in a local cache, rate limiting per user/IP, and load shedding to protect the shard. Mention using a CDN or in-memory cache like Redis.

3. Architectural Solutions for Hot Keys

Discuss longer-term strategies: splitting the hot key into sub-keys (e.g., key+random suffix) to distribute load, replicating the shard, or using a dedicated shard for hot items. Consider consistent hashing with virtual nodes.

4. Trade-offs and Consistency Considerations

Analyze trade-offs: caching may lead to stale data; splitting keys complicates reads/writes; replication increases cost. Discuss how to maintain consistency (e.g., write-through cache, eventual consistency) and monitor effectiveness.

5. Monitoring and Iteration

Explain how you would detect hot keys proactively (e.g., via metrics, sampling) and iterate on the solution. Mention the importance of load testing and chaos engineering to validate resilience.

Key Points to Mention

  • Caching strategies (local, distributed, CDN) and cache invalidation
  • Rate limiting and load shedding to protect the shard
  • Key splitting or salting to distribute load across shards
  • Replication and read replicas for read-heavy hot keys
  • Consistent hashing and virtual nodes for even distribution
  • Trade-offs between consistency, availability, and latency (CAP theorem)

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

Q4

Walk me through the read API design for serving top-K results, including how you'd handle items that go out of stock or get removed mid-window.

API & IntegrationsSystem Design
Author's notes

Fetch more candidates than K from Redis, like 2x, then filter against a catalog availability cache before returning.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements: read-heavy, low-latency, top-K by some ranking (e.g., popularity, distance, ETA). Then describe a layered design: a fast read path (cache or precomputed top-K) and a consistency mechanism to handle mid-window removals/out-of-stock, likely using versioning or tombstones with async reconciliation.

Pro tip: Emphasize that for top-K, approximate or slightly stale results are often acceptable, but you must guarantee that removed/out-of-stock items are never served. Use a 'soft delete' flag with a short TTL cache and a background invalidator to balance freshness and latency.

1. Clarify requirements and constraints

Ask about K, latency SLA, consistency needs (strong vs eventual), update frequency, and whether out-of-stock items should be filtered or ranked lower. Confirm read/write ratio and geographic distribution.

2. Design the read path for top-K

Propose a precomputed top-K per shard/region stored in a low-latency store (e.g., Redis, local cache). On read, merge results from shards, apply a lightweight filter for availability, and return top-K. Mention pagination or cursor if needed.

3. Handle mid-window removals/out-of-stock

Use a versioned availability flag (e.g., item_status with timestamp) and a tombstone list for removals. On read, filter out items marked unavailable. For strong consistency, do a read-through to a primary store for the final K items; for eventual, use a short TTL cache and a pub/sub invalidation.

4. Address consistency and failure modes

Discuss trade-offs: stale cache may serve removed items briefly; mitigate with short TTL, write-through invalidation, or a 'negative cache' for removed IDs. Handle partial failures by falling back to a secondary index or returning fewer results with a warning.

5. Optimize and monitor

Suggest metrics: cache hit rate, staleness, filter rate, and latency percentiles. Consider adaptive TTL based on item churn. Mention A/B testing for ranking changes and canary deployments for new filter logic.

Key Points to Mention

  • Precomputed top-K per shard with merge on read to reduce latency
  • Versioning or timestamped availability flags to filter out-of-stock/removed items
  • Tombstones or negative caching for removed items to avoid serving them
  • Trade-off between consistency and latency: strong vs eventual consistency
  • Cache invalidation strategies: TTL, write-through, pub/sub
  • Fallback and degradation: return partial results or stale data with warnings

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

Q5

When the batch layer finishes recomputing and writes results back, how do you prevent it from overwriting fresher streaming state in Redis?

System DesignTechnical Trade-offs
Author's notes

You need an explicit merge policy and you have to say it out loud.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by acknowledging the core challenge: reconciling batch recomputation with real-time streaming updates in a shared store like Redis. Then propose a versioning or timestamp-based conflict resolution strategy, such as using monotonic version numbers or watermarks, and discuss how to handle late-arriving data and ensure atomicity.

Pro tip: Mention that you would use Redis transactions or Lua scripts to atomically compare-and-set only if the batch result is newer, and highlight the importance of monitoring and alerting on version conflicts to detect pipeline issues early.

1. Clarify the consistency requirements

Ask whether the system prioritizes freshness (streaming wins) or completeness (batch wins), and whether eventual consistency is acceptable. This determines the conflict resolution policy.

2. Introduce versioning or timestamps

Propose attaching a monotonic version (e.g., batch execution timestamp or sequence number) to each write. The batch layer writes only if its version is greater than the current version in Redis.

3. Implement atomic conditional writes

Use Redis WATCH/MULTI/EXEC transactions or Lua scripts to atomically compare the version and update only if the batch version is newer, preventing race conditions.

4. Handle late-arriving streaming data

Discuss how to reconcile late events that arrive after the batch write, possibly by allowing streaming to overwrite if its event time is newer, or by using a watermark-based merge.

5. Monitor and alert on conflicts

Set up metrics for version mismatches and write rejections to detect anomalies, and consider fallback strategies like logging conflicts for manual review.

Key Points to Mention

  • Versioning or timestamp-based conflict resolution (e.g., using batch execution time or sequence numbers)
  • Atomic operations in Redis (WATCH/MULTI/EXEC, Lua scripts) to avoid race conditions
  • Trade-offs between freshness and completeness, and how to choose a policy
  • Handling late-arriving data and watermarks in streaming systems
  • Idempotency and exactly-once semantics for batch writes
  • Monitoring and alerting for version conflicts to ensure data integrity

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

Q6

How would you handle deduplication, bot filtering, and weighted engagement signals in the popularity calculation?

System DesignData Modeling
Author's notes

Dedup by event ID, filter known bot traffic, optionally throttle to one event per user per item per session so rankings can't be gamed.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and scale (e.g., Uber's scale, real-time vs batch). Then propose a multi-stage pipeline: deduplication, bot filtering, and weighted engagement scoring, explaining each stage's techniques and trade-offs. Finally, discuss how to combine these into a popularity score and address challenges like data skew and latency.

Pro tip: Emphasize that deduplication and bot filtering should happen before aggregation to avoid skewing results, and consider using approximate algorithms (e.g., HyperLogLog) for scalability. Also, mention that weights should be configurable and A/B tested to align with business goals.

1. Clarify Requirements and Scale

Ask about data volume, velocity, and latency requirements. Understand what 'popularity' means for Uber (e.g., restaurant or driver popularity) and the impact of bots.

2. Design Deduplication Strategy

Propose deduplication using unique identifiers (e.g., user ID + content ID) and techniques like Bloom filters or streaming dedup with windowing to handle duplicates in real-time.

3. Implement Bot Filtering

Outline bot detection using heuristics (e.g., request rate, pattern analysis) and machine learning models. Discuss how to integrate filtering into the pipeline without adding significant latency.

4. Define Weighted Engagement Signals

Assign weights to different engagement types (e.g., likes, shares, comments) based on business value. Explain how to compute a weighted sum and normalize it to avoid bias.

5. Combine and Optimize

Describe how to aggregate the cleaned and weighted signals into a popularity score. Discuss trade-offs between accuracy and performance, and how to handle data skew and ensure scalability.

Key Points to Mention

  • Deduplication techniques: Bloom filters, streaming dedup with windowing, exact vs approximate methods.
  • Bot detection: heuristics (rate limiting, IP analysis), ML models, and real-time vs batch processing.
  • Weighted engagement: assigning weights based on business metrics, normalization, and avoiding feedback loops.
  • Scalability: using distributed systems (e.g., Kafka, Flink, Spark) and approximate algorithms (HyperLogLog, Count-Min Sketch).
  • Trade-offs: latency vs accuracy, cost of false positives in bot filtering, and configurability of weights.
  • Monitoring and iteration: A/B testing, metrics to track, and adapting to evolving bot patterns.

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