Design a Real-Time Fleet Location Display
Design an operations-facing map that ingests sequenced vehicle positions and keeps bounded viewports fresh under reconnects, hotspots, and out-of-order delivery.
Problem statement
For this exercise, assume authorized fleet gateways publish each vehicle's latest coordinate, service status, event time, and monotonically increasing sequence number. Operations users open a bounded map viewport, receive an initial snapshot, and then subscribe to changes for vehicles inside that viewport.
A newer sequence must never be replaced by an older or duplicate update. Healthy updates should appear within three seconds; mark a vehicle stale after 15 seconds without an accepted update and remove it from the live display after 60 seconds.
A slow viewer may receive only the latest coalesced state per vehicle, but after any gap or reconnect it must obtain a consistent snapshot and resume point. Exclude dispatch and assignment, nearest-vehicle ranking, route planning, vehicle control, payments, long-term location history, and fleet analytics.
What to build
- An authorized fleet gateway can publish sequenced latest location and service status without duplicate or reordered delivery regressing vehicle state.
- An operations user can load a bounded viewport snapshot containing current, stale, and freshness metadata for visible vehicles.
- An operations user can subscribe to coalesced viewport changes and safely resynchronize after lag, a gap, or reconnect.
At scalePractice assumption
- Support 50,000 concurrently active vehicles, one normal update per vehicle per second, and peaks of 100,000 accepted updates per second.
- Support 10,000 concurrent operations viewers, each with at most four active viewports and no more than 5,000 visible vehicles per viewport snapshot.
- Accepted state should become visible within three seconds in healthy operation, state older than 15 seconds is marked stale, and state older than 60 seconds is removed from the live display.
- Survive a single-zone failure, preserve monotonic latest state, and let a viewer recover a consistent snapshot and resume stream within 30 seconds.