Back to sketch

SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 25

Design surge pricing for a ride-hailing app

Advanced · 45 min · Geospatial & marketplaces

When many riders open the app in an area with few free drivers, the fare goes up to draw drivers in and ration rides. A rider sees the multiplier in a quote before requesting and expects to pay what they were shown.

Requirements

  • Every 30 seconds, compute a price multiplier for each area from recent demand (riders asking for quotes) and supply (available drivers).
  • Return a quote with the multiplier for the rider's pickup point.
  • Honour a quote for its validity window even if the area's multiplier changes in the meantime.
  • Let operations cap or freeze multipliers for a city or area, effective within one minute.

Constraints and assumptions

  • 300 cities divided into hexagonal cells of about 1 km²; up to 500,000 cells have activity at peak.
  • 1.5 million online drivers send a location every 4 seconds (about 375,000 events per second).
  • Up to 100,000 quote requests per second at peak; quote API p99 under 150 ms.
  • Multipliers range from 1.0 to 5.0 in steps of 0.1; a quote is valid for 5 minutes.

Out of scope for the first sketch

Choosing the pricing curve itself (assume a function from supply and demand to a target multiplier) · Driver incentives and payouts · Matching drivers to riders · Payments

Draw your design

Rough math and notes

Done on paper? Compare with the worked approaches