Code Room
System designHard
Question
Design a 'nearby drivers' query service where both the queried set (drivers) and the queriers (riders) are constantly moving. A rider opening the app needs the ~20 nearest available drivers, ranked by ETA not raw distance, returned in <50ms, while 300k drivers update their location every 4 seconds. Unlike a static POI search, the index is being rewritten constantly. Describe the dynamic spatial index, how you serve k-NN under continuous churn, how you rank by ETA, and the consistency trade-off between index freshness and query latency.
What a strong answer looks like
Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.
Learn the concepts
Loading whiteboard…
Run or narrate your approach, then ask the coach.