This question evaluates the ability to design scalable, low-latency geospatial lookup services under high update and query rates, assessing skills in spatial indexing, real-time state management, partitioning/sharding, and availability-versus-consistency trade-offs.
You are building a backend service for a ride-hailing app.
Taxis can come online (available) or go offline (unavailable) at any time. Clients need to query, for a given location, the distance (or ETA proxy) to the nearest available taxi.
Assume locations are either:
UpdateTaxiStatus(taxi_id, location, status)
where
status ∈ {online, offline}
GetNearestTaxi(location) -> (taxi_id, distance)
(or return just
distance
)