Back to sketch

SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 40

Design driver dispatch for ride requests

Advanced · 45 min · Geospatial & marketplaces

A rider taps Request and expects a driver to accept within seconds. The system has to choose among nearby available drivers, send one an offer, and move on quickly if that driver declines or ignores it, while thousands of other requests in the same city compete for the same drivers.

Requirements

  • For each ride request, find available drivers near the pickup and choose one by estimated time to pickup, not straight-line distance.
  • Send the chosen driver an offer they can accept or decline within 15 seconds; on decline or timeout, offer the ride to the next candidate.
  • A driver is never assigned to two active rides, and a ride is never assigned to two drivers.
  • The rider can cancel at any time; after 2 minutes without an acceptance, tell the rider no driver was found.

Constraints and assumptions

  • 1.5 million online drivers send a location every 4 seconds; positions can be up to 8 seconds stale.
  • Peak load is 2,000 ride requests per second worldwide, with the busiest city at 300 per second.
  • The first offer should go out within 1 second of the request; candidate search must take under 100 ms.
  • About 70% of first offers are accepted.

Out of scope for the first sketch

Pricing and surge · Live tracking after acceptance · Shared or pooled rides · Driver payouts and ratings

Draw your design

Rough math and notes

Done on paper? Compare with the worked approaches