Layer 3 · Go deeper · 8 min
Go deeper
Size it, build it, then make the calls an interviewer will push you on.
Back of the envelope
Size it up
Tap through each step of the arithmetic.
How much load do 500,000 live drivers put on Redis?
How often does a moving driver change 6-character cell?
Build-up · 5 steps
Find every driver within 500 m
Geohash turns “near me” into prefix scans. One cell isn’t enough; nine always are, as long as each cell is as big as the radius.
Step 1 of 5
Pick the cell size
Use the longest geohash whose cell is still as big as the radius in both directions. For 500 m that is 6 characters, cells 1.16 km × 0.61 km in Mumbai.
4 interview moments
You’re the candidate
The interviewer pushes on the hard parts. Pick an approach and see how it holds up.
Deep dive 1 of 4
Interviewer
“Assume 500,000 drivers online, each pinging every 4 seconds. Riders search within 2 km. Where do the live positions go?”
Your move. Pick an approach:
Deep dive 2 of 4
Interviewer
“Surge pricing compares ride requests with free drivers in each patch of a city, and each patch with its neighbours. How do you bucket them?”
Your move. Pick an approach:
Deep dive 3 of 4
Interviewer
“You build the grid yourself in Cassandra, with the geohash cell as partition key. How do you find drivers within 2 km of a pickup?”
At 100 drivers per km² in the core, the matcher needs only the nearest 20.
Your move. Pick an approach:
Deep dive 4 of 4
Interviewer
“Your 10 million restaurants already live in PostgreSQL. How do you find the ones within 2 km of a customer?”
Your move. Pick an approach: