Design Ride Matching
System Design Cases: lesson 9 of 20
The write rate is the problem; the search is one cell lookup.
Lesson 9 of 20 · 7 min
Design Ride Matching
Step 1 of 11
Fifty thousand drivers pinging every four seconds is 12 500 writes a second.
The Idea
Find a nearby driver within seconds, from a map where every position is stale after four. Assume 50 000 active drivers in one city, each pinging its location every four seconds — 12 500 writes a second against a far smaller number of ride requests.
Real-World Example
A taxi rank organised by street. The dispatcher never scans the whole city: they look at the blocks around you, then at the ring of blocks beyond, and stop as soon as somebody is free.
The Tradeoff
Indexing positions by grid cell turns "who is near me" into a handful of lookups and makes the cell boundary a lie, so the neighbours must be read too. Keeping those positions in memory is what survives the write rate; the durable record only appears once a trip is accepted.
Your turn
Put the steps in the right order.
- Offer the ride to the best candidate and hold it until they answer
- Write each driver's ping into its grid cell in memory
- Read the rider's cell and its eight neighbours
- Rank the candidates by road ETA, not straight-line distance
Mini quiz
1 / 3