Real-Time Fleet Tracking for 50K Vehicles
Re-platforming a polling-based tracker into a streaming pipeline that ingests 200K location events per second with sub-second dashboards.
The dispatch team polled vehicle GPS every 30 seconds, hammering a relational store with writes it could not absorb. Customers complained about stale ETAs; the warehouse missed loading windows; and adding new geofences took weeks of database work.
Vehicles publish MQTT telemetry to a regional broker. A stream processor enriches each event with route metadata, applies geofence rules, and emits derived events (arrival, departure, idle, off-route). Hot state lives in Redis for the dispatch UI; cold data sinks to ClickHouse for analytics and SLA reporting.
┌──────────┐ ┌──────────┐ ┌───────────────┐ ┌──────────┐
│ Vehicles │───▶│ MQTT │───▶│ Stream Proc │───▶│ Redis │
└──────────┘ │ Broker │ │ (geofence + │ │ (live) │
└──────────┘ │ enrichment) │ └────┬─────┘
└──────┬────────┘ │
▼ ▼
┌────────────┐ ┌──────────────┐
│ ClickHouse │ │ Dispatch UI │
│ (history) │ │ (websocket) │
└────────────┘ └──────────────┘- 01
Replaced 30s polling with MQTT QoS 1; battery cost on devices dropped measurably.
- 02
Geofences defined declaratively; rule changes ship in minutes, not weeks.
- 03
Backpressure tested with synthetic 5x peak load to validate broker headroom.
- 04
Exactly-once arrival/departure detection via windowed dedup keyed on (vehicle, geofence).
