System Design
Ride Matching
Design the ride-hailing dispatch and matching system for a service like Uber or Lyft.
Functional requirements
- Riders request a ride from a pickup location and receive a match with a nearby available driver, along with an ETA and a price quote.
- Drivers continuously report their location and availability; the system tracks them in real time.
- The system matches a ride request to the best available driver (proximity/ETA-based) and handles the driver's accept/decline within a timeout, falling back to the next candidate.
- Dynamic (surge) pricing adjusts the quoted price per geographic zone based on real-time supply and demand, and the quoted price is honored for the duration of the trip.
- Riders and drivers see each other's live location from match acceptance through pickup.
Non-functional requirements
- Matching latency: a rider should receive a driver match (or a 'no drivers available' response) within ~10 seconds end-to-end; nearby-driver lookup itself should complete in <200ms.
- Consistency for matching: a driver must never be double-assigned to two concurrent ride requests, even if that costs some additional latency on the assignment step.
- Availability bias elsewhere: location ingestion and ETA/price display can tolerate slightly stale data (seconds); prefer availability for these read paths.
- Location update ingestion must handle sustained high write throughput without backpressure onto driver apps; losing an occasional individual ping is acceptable, losing a driver's presence entirely is not.
- Trip and payment-relevant records (accepted quote, match, trip state transitions) must be durable and auditable.
Scaling & constraints
- 10 million riders DAU and 1 million drivers DAU globally, concentrated in ~500 cities with heavy skew toward the top 20 metros.
- Peak concurrent online drivers: ~300,000, each sending a location update every 4 seconds while online.
- ~15 million ride requests per day, with rush-hour peaks at roughly 5x the daily average rate in a given city.
- Each location update is ~100 bytes; raw location history must be retained for 30 days (safety/audit), trip records retained indefinitely.
- Roughly 20 rider-side reads (nearby-driver map views, ETA checks, price quotes) for every ride actually requested.
- Assume 20% year-over-year growth in both riders and drivers.
Out of scope
- Payment processing, fraud detection, and payout to drivers.
- Routing/navigation engine internals (assume an ETA service exists that returns travel time between two points).
- Ratings, reviews, and driver onboarding/background checks.
- Pool/shared-ride matching (single rider to single driver only).
Sign in to save your progress
AI design evaluation
Get a grounded score, what your design does well, its gaps, and what to study next.
Sign in to get AI feedback on your design.