Loading...
Loading...
Design an on-demand ride-hailing system similar to Uber, where riders can request transportation through a mobile application and be matched with nearby available drivers. A rider enters a pickup location and destination, receives an estimated fare, and confirms a ride request. The system must then identify an available driver and coordinate the ride between the passenger and driver.
The central challenge is matching riders with available drivers quickly while maintaining assignment correctness. The system should complete ride matching or report that no match is available within one minute. At the same time, it must ensure that a driver cannot be assigned to multiple rides simultaneously, even when requests arrive concurrently.
The platform must also support drivers accepting or declining incoming ride requests. Once a driver accepts a ride, the driver should be able to navigate to the rider's pickup location and then to the destination. These operations form the core ride-request and dispatch workflow.
Another important challenge is handling concentrated demand during peak periods. Rush hours and large events may generate extremely high request volumes from the same geographic location. The system must accommodate scenarios involving up to 100,000 ride requests originating from one area without compromising matching correctness.
The design focuses on fare estimation, on-demand ride requests, nearby driver matching, driver acceptance or rejection, and navigation to pickup and drop-off. Post-trip ratings, scheduled rides, and different vehicle categories are outside the scope.
Fare Estimation: Riders can enter a pickup location and destination and receive an estimated fare before requesting a ride.
Ride Request Creation: Riders can confirm a ride request based on the estimated fare, initiating the process of finding an available driver.
Nearby Driver Matching: The system must identify drivers who are geographically close to the requested pickup location and currently available to accept a ride. A rider should be matched with an eligible driver within the required matching window or receive a failure result.
Driver Acceptance and Navigation: Drivers can accept or decline incoming ride requests. After accepting a ride, drivers can navigate to the pickup location and subsequently to the rider's destination.
Low-Latency Matching: Complete the ride-matching process or report matching failure within one minute.
Strong Assignment Consistency: Ensure that an available driver cannot be assigned to multiple rides simultaneously. Ride matching must maintain correct driver assignment state when multiple requests compete for the same driver.
High Throughput: Support high volumes of incoming ride requests, particularly during rush hours and major events.
Concentrated Demand Handling: Accommodate traffic spikes involving approximately 100,000 ride requests originating from the same geographic location.
The following requirements establish the expected performance and workload characteristics.
| Parameter | Requirement |
|---|---|
| Service type | On-demand ride-hailing |
| Matching latency | Under 1 minute |
| Matching outcome | Driver assigned or failure returned |
| Peak concentrated demand | ~100,000 requests from one location |
| Driver eligibility | Nearby and available |
| Assignment consistency | Strong consistency |
| Concurrent driver assignments | At most one ride per driver |
| Ride request input | Pickup location and destination |
| Pricing interaction | Fare estimate before ride confirmation |
| Driver response | Accept or decline |
| Navigation | Pickup and drop-off |