← Uber Interview Insights

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

SeniorPrefer not to say
Jun 2026

Summary

Uber SWE interview focused on designing a rate limiter from scratch, with a bunch of follow-ups that escalated pretty fast into distributed systems territory. The core question seems straightforward but they really push you on the edges.

Questions Asked (3)

Q1

Design a rate limiter with an allow(user_id, timestamp) interface that enforces a sliding window policy of at most N requests per W seconds per user.

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

This is the kind of question where you think you know it and then the follow-ups make you realize you only knew half of it.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints (e.g., single-node vs distributed, memory limits, precision of sliding window). Then propose a sliding window log or counter approach, analyze time/space complexity, and discuss trade-offs and scalability.

Pro tip: Mention that a true sliding window can be approximated with a fixed window counter or a sliding window counter to save memory, and discuss how to handle distributed rate limiting using a centralized store like Redis with atomic operations.

1. Clarify Requirements

Ask about scale (number of users, QPS), memory constraints, whether the system is distributed, and the required accuracy of the rate limiting.

2. Choose Data Structure & Algorithm

Propose a sliding window log using a deque or a sorted set per user, or a sliding window counter using two fixed windows. Explain how to enforce the limit.

3. Analyze Complexity & Trade-offs

Compare time and space complexity of different approaches (e.g., log vs counter), and discuss precision vs memory usage.

4. Handle Distributed & Scalability Concerns

Discuss using a centralized store (e.g., Redis) with atomic operations, sharding, and handling race conditions.

5. Discuss Edge Cases & Optimizations

Cover timestamp precision, clock skew, cleanup of old entries, and potential optimizations like approximate counting.

Key Points to Mention

  • Sliding window log using a deque or sorted set per user, storing timestamps of requests.
  • Sliding window counter approximation using two fixed windows to reduce memory.
  • Time complexity: O(1) amortized for checking and updating; space complexity: O(N) per user for log, O(1) for counter.
  • Distributed rate limiting with Redis and Lua scripts for atomicity.
  • Trade-offs: accuracy vs memory, and how to handle high cardinality of users.
  • Edge cases: timestamp precision, clock skew, and cleanup of expired entries.

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

Q2

How would you extend the rate limiter to support multiple users with different limits, and also per-endpoint rules?

System DesignTechnical Trade-offs
Author's notes

Pretty natural follow-up.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements: multiple users with different limits and per-endpoint rules. Then propose a design that separates identity (user) and resource (endpoint) dimensions, using a composite key and a rules engine to resolve the applicable limit. Discuss trade-offs between simplicity and flexibility, and how to handle distributed rate limiting at scale.

Pro tip: At Uber, rate limiting is often about protecting shared resources while allowing critical traffic; mention how you'd handle priority users or endpoints (e.g., driver app vs. rider app) and the need for real-time configuration updates without redeploying.

1. Clarify Requirements and Scope

Ask about the expected scale (number of users, endpoints, QPS), whether limits are static or dynamic, and if there are different tiers of users (e.g., free vs. premium). Also confirm if the rate limiter is distributed or single-node.

2. Design the Key Structure

Propose a composite key that combines user ID and endpoint (e.g., 'user:123:endpoint:/api/rides'). This allows independent tracking of each user-endpoint pair. Discuss how to handle global user limits and global endpoint limits as separate keys.

3. Implement a Rules Engine

Describe a configuration system that maps (user, endpoint) to a limit. This could be a hierarchical rule set: default global limit, overridden by endpoint-specific limits, overridden by user-specific limits. Mention using a fast lookup store like Redis or an in-memory cache with pub/sub for updates.

4. Choose a Rate Limiting Algorithm

Select an algorithm that supports multiple limits efficiently, such as sliding window or token bucket. Explain how to apply multiple limits (e.g., per-user and per-endpoint) by checking all applicable buckets and taking the most restrictive.

5. Address Distributed Coordination and Trade-offs

Discuss how to synchronize counters across nodes (e.g., using Redis with Lua scripts for atomicity). Trade-offs: accuracy vs. latency, centralized vs. decentralized, and how to handle failures (e.g., fail-open vs. fail-closed).

Key Points to Mention

  • Composite key design: user + endpoint to track limits independently.
  • Hierarchical rule resolution: global, endpoint, user, and user-endpoint overrides.
  • Use of Redis or similar for distributed counters with atomic operations (Lua scripts).
  • Algorithm choice: sliding window or token bucket for flexibility and accuracy.
  • Handling multiple limits: check all applicable limits and enforce the strictest.
  • Trade-offs: consistency vs. availability, latency, and dynamic configuration updates.

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

Q3

How would you make this rate limiter work in a distributed environment with multiple service instances behind a load balancer?

System DesignTechnical Trade-offsAPI & Integrations
Author's notes

This is where it got real.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by acknowledging that a single-instance rate limiter (e.g., in-memory) fails in a distributed setup due to inconsistent state. Then propose a centralized store like Redis with atomic operations, and discuss trade-offs between accuracy, latency, and availability. Finally, mention alternatives like sticky sessions or distributed counters with eventual consistency, and how to handle failures.

Pro tip: Emphasize that the choice depends on the required strictness: for strict global limits, use Redis with Lua scripts; for approximate limits, consider a decentralized approach with gossip or local limits plus periodic sync. Also, mention monitoring and dynamic adjustment of limits.

1. Identify the problem

Explain why a single-instance rate limiter doesn't work: each instance has its own counter, leading to inconsistent enforcement and potential overload. The load balancer distributes requests, so a global view is needed.

2. Choose a centralized store

Propose using a fast, shared data store like Redis or Memcached. Redis is preferred for its atomic operations (INCR, EXPIRE) and Lua scripting for complex logic.

3. Implement atomic operations

Use Redis Lua scripts to atomically check and increment counters, ensuring race conditions are avoided. For sliding window, use sorted sets with timestamps.

4. Handle failures and trade-offs

Discuss what happens if Redis is down: fallback to local rate limiting (fail-open or fail-closed), or use a distributed cache with replication. Also, consider latency added by network calls.

5. Consider alternatives and optimizations

Mention sticky sessions (if acceptable), or a hybrid approach: local rate limiting with periodic sync to a central store for approximate global limits. Also, discuss sharding the rate limiter by user ID to scale.

Key Points to Mention

  • Redis with atomic INCR/EXPIRE or Lua scripts for atomicity
  • Sliding window vs fixed window algorithms and their distributed implications
  • Trade-offs: consistency vs availability (CAP theorem), latency vs accuracy
  • Handling Redis failures: fallback strategies, circuit breakers
  • Sharding or partitioning the rate limiter to avoid hotspots
  • Monitoring and dynamic adjustment of rate limits based on traffic

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