System design
Design a ride-hailing service
Design the core of a ride-hailing service. A rider requests a ride from where they are, the service offers it to a nearby available driver, and once a driver accepts, each side sees the other’s location live until the trip ends.
At peak there are 1 million active drivers, each sending a GPS update every 4 seconds, and 2,000 ride requests a second. A rider should be matched within a few seconds, and a driver must never hold two rides at once.
Things to cover
- Storing driver locations and finding the nearest available ones
- The matching flow, from request to accepted ride
- Making sure a driver gets only one ride at a time
- Splitting the work by city or region, and what happens when one fails