Uber system design, reverse-engineered: from tap to pickup
How Uber turns a ride request into an assigned driver, walked through in real interview order: numbers, API, high-level design, one request end to end, databases, geo search, cancellations, and what happens when each service fails.
The 1-minute answer
How this page follows the interview
Each phase is a section below, in the order you'd present it. Click a phase for what to say, what to write, and the trap.
Requirements and numbers
Agree scope, then size it. Change any input: each number below comes with the decision it forces, and the same decisions reappear in the design and database sections.
Functional
- Rider sees a fare and nearby cars
- Rider requests; one driver is matched within seconds
- Driver accepts or declines; both see live tracking
- Either side cancels; trip completes; rider pays
Non-functional
- Tap to offer on the driver's phone: under 1 s (p95)
- Matching stays up; locations may be a few seconds stale
- Ride state and payments: correct, never duplicated
- Survive a service, or a whole data centre, failing mid-trip
Out of scope (say it)
Onboarding, ratings, support tooling, building maps.
Capacity calculator
4 s pings ✅ and the ~1M writes/s target ✅ are from Uber's 2015 talk. The rest are assumptions 🔶: say them out loud.
- Per second = per day ÷ 86,400 (seconds in a day). Round it to ~100,000 in your head.
- Peak = average × a peak factor (2–3× for rush hour). Design for the peak.
- Separate writes from reads, and ask of each number: does it change a decision? If not, skip it.
Core entities and the API
Name the entities first, then the few calls that move them. Keep it short in the interview; what they listen for is who owns the price, and why a retry is safe.
| Entity | Key fields | Note |
|---|
How the fare is calculated
The estimate call runs this on the server and stores the result behind fare_id. Rates are set per city and product; the ones below are made up for the example. Change the trip and watch each line.
Where each number comes from
- Distance and duration: the routing engine's estimate of the route, before the trip starts. 🔶
- Rates: base, per km, per minute, booking fee and minimum fare, configured per city and product. 🔶 reported 2016
- Surge: demand ÷ supply in the pickup's H3 cell, smoothed over neighbouring cells and the last few minutes so it doesn't jump. ✅ H3 2018
- Upfront price: the rider sees the final number before booking, and it's locked in the quote behind
fare_idfor 2 minutes. ✅ Riders API
Surge multiplies the time-and-distance part; the booking fee and tolls are added after. Exact rules vary by city.
High-level design
Build it in passes and say why each box exists. Click any box to see what it does, what it owns, what's inside it and what you'd watch.
Walk one request, box by box
From driver pings to the rider being charged. Each step lights up the path, and shows what goes over the wire, where it's stored and how long it takes.
Arrows show who calls whom, and the numbers give the order. Replies go back along the same line.
Who sends a push, and how it reaches the phone
Services never talk to phones directly. They publish what changed, and the push platform decides, builds and delivers. Uber splits this into three parts.
The same ride from both phones
The two apps never talk to each other. Commands go up over HTTPS; updates come down one push stream per app.
Data and database choices
"Which database, and why?" is guaranteed. Start from the access pattern and your numbers, then name the store and what you gave up.
| Data | Pick | Considered | Why not those |
|---|
Database decision helper
Answer four questions about any piece of data. Say them out loud: the questions are the reasoning.
Atomic accept: the one query to know
-- Only one driver can win; retries are harmless.
UPDATE rides
SET status = 'accepted',
driver_id = :driver_id,
version = version + 1
WHERE ride_id = :ride_id
AND status = 'offered'
AND offered_driver_id = :driver_id
AND version = :expected_version;
-- 1 row updated → accepted
-- 0 rows updated → offer expired or taken: 409Compare-and-set with a version column. In a key-value store, the same idea is a conditional put.
More database questions
Deep dive: finding the driver
Toggle ranking, road works and heading. The closest driver is often not the best one: a river with one bridge, a U-turn or road works can make a nearby driver the slowest. One block ≈ 30 s in this toy model.
Ranking
| # | Driver | Straight | Road ETA | Why |
|---|
The search algorithm
cell = latLngToCell(pickup, res): map the pickup to its hexagon. ✅ H3- For k = 1, 2, …: read drivers in
kRing(cell, k)from the shards that own those cells; stop when there are enough. ✅ H3 + 2015 talk - Filter by status (available, or finishing nearby) and product (seats, XL, wheelchair). ✅ supply service
- Pre-sort by straight-line distance, keep the top N. 🔶
- Batch road ETAs for the N: routing engine + DeepETA correction, a few ms. ✅ DeepETA
- Score = ETA + business terms (acceptance chance, fairness). Offer to the best. ❓ weights
Why hexagons?
Every neighbour of a hexagon is the same distance from its centre; squares have edge and corner neighbours at different distances. That keeps "search outward in rings" and surge smoothing even. H3 has 16 resolutions, each about 1/7 the area of the one above. ✅ Uber, 2018
Complexity: cell lookup is O(1); a k-ring has 3k(k+1)+1 cells; candidates are bounded by drivers in those cells, not by the city.
Ride lifecycle and cancellations
Statuses use the names from Uber's public API. Click events to move the ride; invalid ones are disabled, because the server enforces them with compare-and-set. Each event shows what fires across the system.
Edge cases interviewers love
Failure, monitoring and recovery
"What if this goes down?" follows every diagram. Click a box to take it down: red is the failed service, amber is its blast radius. Each answer covers impact, degraded mode, the alert that fires, automatic and manual recovery, and how you'd trace it.
Tracing it back: one request, healthy vs ETA timing out
Every span carries the request id and ride id. In the bad trace, the ETA call hits its 50 ms deadline and dispatch falls back to distance ranking: slower and slightly worse, but the ride still matches.
How one failure becomes three
What you'd alert on (SLOs)
| Signal | Target | Alert |
|---|
Incident playbook
The resilience toolkit
Name the pattern, then say where it goes in this design.
Making it fast, and who owns what
Machine time is milliseconds; human time dominates. Make the machine path fast so the driver sees the offer instantly, then work on acceptance. Bars are sizing estimates, not Uber figures.
| Team | Owns | Paged when… |
|---|
Senior follow-ups beyond the happy path
Interviewers pick from these themes once the design is on the board. Have one concrete answer per theme, tied to this design.
Practice ladder
Real interviews go level by level. Answer out loud before opening each one. Levels 6–7 are where Senior becomes Staff.
Sources
- Uber Riders API reference: POST /requests and /requests/estimate (v1.2), Uber Developers
- How Uber Scales Their Real-time Market Platform, High Scalability (14 Sep 2015)
- Designing Schemaless, Uber's Scalable Datastore Using MySQL, Uber Engineering (12 Jan 2016)
- H3: Uber's Hexagonal Hierarchical Spatial Index, Uber Engineering (27 Jun 2018)
- Uber's Real-Time Push Platform, Uber Engineering (18 Dec 2020)
- DeepETA: How Uber Predicts Arrival Times, Uber Engineering (10 Feb 2022)
- Uber's Next Gen Push Platform on gRPC, Uber Engineering (16 Aug 2022)
Sources date from 2015 to 2022; Uber's current internals may differ. In an interview, say so.
System Design Mastermind · Classics
Series homeAll of Classics
6 published · 4 comingThe problems almost every loop draws from.
Uber system design, reverse-engineered: from tap to pickup
In-memory geo index sharded by map cell → rank nearby drivers by road ETA → offer to one driver with a 15 s timeout → accept with compare-and-set → push updates to both apps.
Rate limiter system design: fair limits at a million requests a second
Check every request once in the API gateway → one atomic Lua script per request on the caller's shard of a sharded Redis (token bucket for per-second, window for per-day) → 429 + Retry-After, or forward with RateLimit headers → local cache for keys already over → each rule fails open or closed on purpose.
WhatsApp system design: chat, offline delivery and the three ticks
One long-lived encrypted connection per device → the chat server stores a copy per recipient device in a replicated offline queue, then acks (✓) → session lookup, forward or push → the device saves and acks, the copy is deleted (✓✓) → a read receipt when opened. Client-made ids and dedupe at both ends, backoff with jitter on reconnect, Sender Keys for groups.
Ticketmaster system design: selling seats without double-booking
Cached reads for browsing → a seat inventory with one row per seat, sharded by event → a hold is one conditional UPDATE (only if free or expired) with a 10-minute timer → pay with a client-made idempotency key → confirm only if the hold is still yours, plus an outbox for tickets. A waiting room admits fans at the rate booking can serve.
News feed system design: fan-out, celebrities and ranking
Write each post once → fan-out workers push its id into active followers' capped Redis timelines → accounts above ~1M followers are merged at read time instead → the feed service gathers ~1,500 candidates, a light model trims them, a heavy model predicts actions, a weighted sum orders them → deletes and blocks are checked at read time, pages use a cursor.
Notification system design: push, email and SMS without spam, drops or duplicates
One Notify API with an idempotency key → a router checks dedupe, preferences, caps and quiet hours, picks live devices → per-channel queues with a transactional lane apart from bulk → workers call APNs, FCM, email and SMS with priority, expiry and a collapse id, retry 429s with backoff and delete dead tokens → campaigns paced below the provider quota, OTPs fall back to SMS.