Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Nearby Autonomous Vehicle Search Service

Design a low-latency, jitter-aware geospatial service that indexes fresh autonomous-vehicle state, asynchronously persists accepted location history, and returns nearby eligible vehicles under skewed traffic.

Problem statement

For this exercise, assume a mobility fleet in which active autonomous vehicles publish their latest coordinate and service status about every four seconds, and a dispatch client searches from a pickup coordinate for up to 20 nearest eligible vehicles within a maximum 10-kilometer radius.

Rank results by straight-line distance and then vehicle ID for deterministic ties. Each vehicle update includes a monotonically increasing sequence number, and the system must not regress to an older state when messages are duplicated or reordered.

Keep the fresh serving position in a low-latency index, asynchronously persist the accepted location history, and define a jitter policy that avoids needless cell churn without hiding material movement.

A location update should become searchable within five seconds in healthy operation, and vehicles whose latest accepted update is more than 15 seconds old must not be returned. Search results are advisory snapshots; a separate assignment system must revalidate a candidate before committing a trip.

Exclude trip assignment and reservation, route planning, rider payments, vehicle perception or control, trip-history products, and fleet analytics.

What to build

  1. An authorized vehicle or fleet gateway can publish a sequenced latest location and eligibility state without an older or duplicate update replacing newer state.
  2. A dispatch client can request the nearest eligible vehicles around a coordinate within a bounded radius and limit.
  3. Search excludes vehicles whose latest accepted state is stale or ineligible and returns freshness metadata with each advisory result.
  4. The service asynchronously persists accepted location samples without delaying the fresh in-memory serving path.
  5. The serving index suppresses harmless coordinate jitter and cell churn while preserving sequenced material movement and correct nearby results.

At scalePractice assumption

  • Support 1 million concurrently active vehicles, each normally publishing one state update about every four seconds, with peaks of 300,000 accepted updates per second.
  • Serve up to 100,000 nearby-search requests per second with responses below 200 milliseconds at p95.
  • Searches request at most 20 vehicles within 10 kilometers; an accepted update should become searchable within five seconds, and state older than 15 seconds is ineligible.
  • The service should survive a single-zone failure without regressing vehicle sequence numbers and should rebuild a damaged regional search index from durable latest state and replayable updates within 30 minutes.