← Back to All Questions
Hard~55 minLocation-Based Services

Design Uber Ride Matching - Find Nearby Drivers

UberLyftDoorDashInstacartGrab

📝 Problem Description

Design the ride matching system for Uber. When a rider requests a ride, find nearby available drivers, rank them, and dispatch the best match. Handle real-time driver location updates and dynamic supply/demand.

👤 Use Cases

1.
Rider wants to requests ride so that matched with nearby driver
2.
Driver wants to goes online so that visible for matching
3.
Driver wants to updates location so that position updated in system
4.
System wants to matches ride so that driver receives ride request

✅ Functional Requirements

  • Find drivers within X km of pickup
  • Rank drivers by ETA, rating, ride type
  • Send ride request to selected driver
  • Handle driver accept/reject
  • Track driver locations in real-time

⚡ Non-Functional Requirements

  • Match latency < 2 seconds
  • Location updates every 4 seconds
  • Support 1M concurrent drivers
  • 99.9% availability

⚠️ Constraints & Assumptions

  • Drivers move constantly
  • Must handle geo-clustering (downtown)
  • Peak times require fast matching

📊 Capacity Estimation

👥 Users
1M concurrent drivers, 10M daily rides
💾 Storage
10GB (active driver locations)
⚡ QPS
Location updates: 250K/sec, Ride requests: 1K/sec
📐 Assumptions
  • 1M active drivers at peak
  • Location update every 4 seconds
  • 10M ride requests per day
  • Average 5 nearby drivers per match
  • Match radius: 3-5 km typical
  • Driver accept rate: ~50%

💡 Key Concepts

CRITICAL
Geospatial Indexing
QuadTree, S2 Cells, or GeoHash for efficient proximity queries.
CRITICAL
Real-time Location Updates
Process millions of GPS updates per second.
HIGH
ETA Calculation
Estimate time to pickup using routing service.
HIGH
Driver Ranking
Score by ETA, rating, acceptance rate, vehicle type.

💡 Interview Tips

  • 💡Start with the matching algorithm
  • 💡Discuss geospatial indexing early
  • 💡Emphasize real-time requirements
  • 💡Be prepared to discuss surge pricing
  • 💡Know the tradeoffs between speed and quality
  • 💡Understand the driver supply/demand balance