← Uber Interview Insights

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

SeniorPrefer not to say
Jun 2026

Summary

Uber system design round focused entirely on a real-time Top-K ranking system, the kind of thing you'd use for driver leaderboards or restaurant rankings. Four parts back to back: core data structures, concurrency, batch ingestion with error handling, and testing. Pretty dense for one session.

Questions Asked (4)

Q1

Design an object-oriented, real-time Top-K ranking system that supports update, top_k, and remove operations on a large set of entities with numeric scores.

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

The core trap I nearly fell into was reaching for a single heap and calling it done.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (scale, update frequency, latency, consistency) and then propose a two-layer architecture: a fast in-memory index for real-time updates and a persistent store for durability. Discuss data structures like hash maps for O(1) updates and a heap or balanced tree for top-K queries, and explain trade-offs between exact and approximate results.

Pro tip: Emphasize that real-time ranking often requires approximate algorithms (e.g., count-min sketch) to handle high throughput, and mention how you'd handle sharding and hot entities to avoid bottlenecks.

1. Clarify Requirements and Constraints

Ask about scale (number of entities, QPS), latency requirements, consistency needs, and whether exact top-K is required. This shapes your design choices.

2. Define Core Data Structures

Propose a hash map for O(1) score updates and a heap or balanced BST for maintaining top-K. Discuss how to handle removals efficiently.

3. Design System Architecture

Outline components: an in-memory index for fast access, a persistent store for durability, and a query service. Consider sharding and replication for scalability.

4. Address Real-Time and Scalability Challenges

Explain how to handle high write throughput, hot entities, and distributed updates. Mention approximate algorithms if exactness is not critical.

5. Discuss Trade-offs and Extensions

Compare exact vs. approximate, in-memory vs. disk-based, and centralized vs. distributed. Suggest monitoring and tuning strategies.

Key Points to Mention

  • Use of hash map for O(1) updates and a min-heap of size K for top-K queries.
  • Handling removals: lazy deletion or maintaining a balanced tree for O(log n) operations.
  • Sharding by entity ID to distribute load and avoid single-node bottlenecks.
  • Approximate algorithms like count-min sketch or t-digest for high-throughput scenarios.
  • Durability via write-ahead logging or periodic snapshots to a persistent store.
  • Trade-offs between exact and approximate results, and between latency and consistency.

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

Q2

How does your design change when multiple threads are calling update, remove, and top_k concurrently? How do you keep the two structures consistent and scale write throughput?

System DesignTechnical Trade-offs
Author's notes

Started with a single read/write lock around both structures, which is correct but bleeds throughput under heavy writes since everything serializes.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the consistency requirements and the expected read/write ratio, then propose a concurrency control strategy that balances correctness and throughput. Discuss how to keep the two structures consistent using techniques like fine-grained locking, lock-free operations, or transactional memory, and explain how to scale writes via sharding or partitioning.

Pro tip: Mention that you would first measure the contention points and consider read-optimized approaches like copy-on-write for top_k, since reads often dominate in such systems. Also, highlight the importance of defining clear consistency semantics (e.g., linearizability vs. eventual consistency) based on business needs.

1. Clarify requirements and constraints

Ask about consistency needs, read/write ratio, latency SLAs, and whether operations can be batched. This determines the appropriate concurrency model.

2. Identify shared state and contention points

Analyze how update, remove, and top_k interact with the two structures (e.g., a hash map and a heap). Determine which operations conflict and where locks or synchronization are needed.

3. Choose a concurrency control strategy

Propose options like fine-grained locking (per-bucket locks), lock-free data structures (e.g., concurrent skip lists), or software transactional memory. Discuss trade-offs between simplicity and scalability.

4. Ensure consistency between structures

Explain how to atomically update both structures, e.g., using a global lock for critical sections, or a two-phase commit with versioning. Consider using a single lock for both if contention is low, or separate locks with careful ordering to avoid deadlocks.

5. Scale write throughput

Describe partitioning/sharding by key to distribute load, using per-shard locks. For top_k, consider maintaining local top_k per shard and merging, or using a concurrent heap with lazy deletion.

Key Points to Mention

  • Consistency models: linearizability vs. eventual consistency and their impact on design.
  • Fine-grained locking vs. coarse-grained locking and trade-offs.
  • Lock-free data structures (e.g., ConcurrentSkipListMap, atomic operations) for scalability.
  • Sharding/partitioning to reduce contention and increase write throughput.
  • Read-optimized techniques like copy-on-write or snapshot isolation for top_k.
  • Deadlock avoidance and lock ordering when using multiple locks.

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

Q3

How would you handle very large input batches where some records are malformed or fail during processing, without letting bad records abort the whole batch?

System DesignAPI & Integrations
Author's notes

This one felt more engineering than design.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements: batch size, throughput, latency, and tolerance for failures. Then propose a resilient architecture that isolates bad records, processes good ones, and provides observability and recovery mechanisms. Emphasize trade-offs between consistency, availability, and complexity.

Pro tip: Mention that you would implement a dead-letter queue (DLQ) with rich metadata (error reason, record payload, timestamp) and a replay mechanism, showing you think about operational recovery, not just error handling.

1. Clarify Requirements and Constraints

Ask about batch size, expected failure rate, latency SLAs, and whether partial success is acceptable. This ensures your solution aligns with business needs.

2. Design for Isolation and Fault Tolerance

Propose processing records individually or in small chunks, with try-catch blocks per record. Use asynchronous processing or parallel workers to maintain throughput.

3. Implement Error Handling and Dead-Letter Queue

Route malformed or failed records to a DLQ with detailed error context. Ensure the main batch continues processing without interruption.

4. Add Observability and Monitoring

Emit metrics for success/failure counts, latency, and DLQ size. Set up alerts for abnormal failure rates to enable quick response.

5. Provide Recovery and Replay Mechanisms

Design a way to reprocess DLQ records after fixing root causes, either manually or automatically, with idempotency to avoid duplicates.

Key Points to Mention

  • Dead-letter queue (DLQ) for isolating bad records with error details
  • Idempotent processing to handle retries safely
  • Backpressure and rate limiting to avoid overwhelming downstream systems
  • Monitoring and alerting on failure rates and DLQ size
  • Partial success semantics and how to report them to clients
  • Trade-offs between consistency, availability, and complexity

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

Q4

What tests would you write to verify correctness, edge cases, and concurrency for this system?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Edge cases first: empty ranking, top_k(0), k larger than the population, raising vs lowering a score, duplicate scores to verify the tie-break is actually deterministic, removing an entity that doesn't exist, negative and zero scores.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the system's requirements and components, then structure your answer around three test categories: correctness, edge cases, and concurrency. For each category, describe specific test scenarios, tools, and techniques, and explain how you would validate both functional and non-functional aspects.

Pro tip: Emphasize testability early: suggest designing the system with dependency injection and interfaces to enable mocking and fault injection, which is crucial for concurrency testing. Also, mention that you would prioritize tests based on risk and business impact, not just coverage.

1. Clarify the system and requirements

Ask questions to understand the system's purpose, components, data flow, and critical requirements (e.g., consistency, latency, fault tolerance). This ensures your tests target the right risks.

2. Outline correctness tests

Describe tests that verify the system behaves as expected under normal conditions: unit tests for core logic, integration tests for component interactions, and end-to-end tests for user flows.

3. Identify edge cases and failure scenarios

List boundary conditions (empty inputs, max values), invalid inputs, and failure modes (network partitions, timeouts, partial failures). Explain how you would test these, including property-based testing and fuzzing.

4. Design concurrency tests

Explain how to test for race conditions, deadlocks, and data consistency under concurrent access. Mention techniques like stress testing, deterministic scheduling, and tools (e.g., ThreadSanitizer, Jepsen).

5. Discuss test infrastructure and trade-offs

Cover how you would automate tests, use mocks/stubs, and integrate into CI/CD. Also, discuss trade-offs between test coverage, execution time, and maintenance cost.

Key Points to Mention

  • Unit, integration, and end-to-end testing pyramid
  • Boundary value analysis and equivalence partitioning
  • Property-based testing and fuzzing for edge cases
  • Race condition detection tools (e.g., ThreadSanitizer, Helgrind)
  • Chaos engineering and fault injection for distributed systems
  • Test doubles (mocks, stubs) and dependency injection for testability
  • CI/CD integration and test flakiness mitigation

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