All problems

Ride Sharing

Match riders to drivers in real time across a city.

hard~24 min Pro Simulator · +140 ptsTheory +43 pts
The build

Match riders through a rush-hour surge while a region partitions and the location firehose floods in.

Driver pings are a write firehose — a queue must absorb them before they reach the store, while a geo cache keeps 'who's nearby' a fast lookup. One matching path won't survive the partition.

Components in play

  • Regional LBKeeps a city's traffic in its region.
  • Matching serviceFinds nearby drivers per request.
  • Location ingestAbsorbs the driver-ping firehose.
  • Geo indexIn-memory live positions for fast lookups.
  • Trips storeDurable trip lifecycle state.

Graded on these SLOs

  • ≥ 96.00%Matches succeed
  • ≤ 120 msMatch p99
  • ≥ 15k rpsMatch the demand
  • ≤ 90%Matcher headroom
  • ≤ 13Lean + regional
Base 15,000 rps45s run 4 scripted failures

The brief

Design the matching backend for Uber/Lyft: riders request trips, the system finds nearby drivers, tracks live locations, computes ETAs and surge pricing, and manages the trip lifecycle. Driver location updates are a firehose of writes.

Functional

  • Match riders to nearby available drivers
  • Ingest high-frequency driver locations
  • Trip lifecycle + surge pricing

Non-functional

  • Low-latency geospatial matching
  • Absorb a flood of location writes
  • Regional isolation & high availability

Read the deep dive

16 min read

A ride-sharing backend looks deceptively simple — a rider taps a button, the system finds a nearby car, a trip begins. The hard part hides in the asymmetry of the workload. For every rider request, the drivers around them emit a relentless stream of GPS pings, so the system is dominated not by reads of trips but by a firehose of location writes. On top of that, a match must be fast (a rider is staring at a spinner), geographically scoped (you want the car two blocks away, not across the city), and resilient (a network partition or a dead matcher during rush hour must not stall the whole city). This guide builds the matching backend the way you would in a FAANG interview: clarify what is actually being asked, size the firehose with real numbers, then assemble a region-partitioned architecture with an in-memory geo index, a queue that absorbs the pings, and redundant matcher paths that survive failure. We anchor every decision to a concrete target. The reference design we converge on is a regional load balancer fronting two independent matcher pools, a location-ingest queue, an in-memory geo index, and a durable trips store — tuned to hold a 96 percent match-success rate, a sub-120ms p99, and a throughput floor of at least 15,000 served requests per second as load doubles to 30,000 at rush hour, all while a region partitions, a matcher dies, and the trips store blips. Those are the exact SLOs the SysGym simulator grades you against, so the article and the gym reinforce each other.

Warm-up: design decisions

Optional theory to prime the calls a senior engineer would make before you build.

Pro

Solving is a Pro feature

Unlock the on-canvas AI design coach, per-run design reviews, the chaos simulator and all 12 problems for $15/month.

  • AI design coach on your canvas — pins failure points & over-engineering
  • Honest AI design review on every run
  • All 12 problems + unlimited chaos simulator
  • Points, levels & leaderboard
Get started