TSTier SlateAll templates
  1. Home
  2. Templates
  3. Fleet tracking

Location & logistics

Fleet tracking - 21,600 writes per vehicle per day

Teaches how a continuous position firehose is split into a tiny live picture and an enormous history, and how retention rather than hardware decides what it costs.

  • System design
  • core
  • 8 step walkthrough
  • 5 tables
Own this board 400 creditsPractise as an interview

The first act plays here. Owned once with credits, never a subscription.

Share

  • Facebook
  • X

What this board gets wrong on purpose

The tension

History is downsampled from 4 seconds to 30 at ingest, which turns 518 GB a day into 69 GB and is the single reason the storage bill is five figures rather than seven. It is also irreversible and it is applied before anyone has agreed what the history is for. Thirty seconds is fine for "where was this lorry at 14:00" and useless for the questions that pay for telematics: harsh braking lasts under two seconds and is invisible at 30 s, a stop that is 45 s long may be sampled once or twice depending on phase, and an insurance dispute about a collision needs the second before impact, which by then is gone. The board papers over this with a 7-day full-resolution buffer and an event-triggered keep-everything window around detected incidents - which only works if the detector fires, and the detector runs on the downsampled stream for everything older than a week. The retention tiers are also global rather than per customer, so the fleet paying for forensic-grade telematics gets the same 30-second history as the one that only wants a map, and the only lever anybody has is to make it worse for everybody or more expensive for everybody.

Practise this as an interview

Take Fleet tracking - 21,600 writes per vehicle per day as a timed system design interview on a blank board - on your own, with the requirements to check yourself against, or with a candidate you invite.

Practise this as an interview

Start here

Why this design

Fleet tracking is the cleanest example of a write-dominated system: half a million devices produce 125,000 writes a second while a few thousand people read the result. Interviewers use it to see whether you do the multiplication before drawing a schema, whether you separate "where is it now" from "where has it been", and whether you treat retention and downsampling as product decisions rather than ops chores. The same shape - IoT telemetry, metrics, ride and delivery tracking - is what real platform teams build and pay for, and the bill is decided by three numbers set long before the first server is bought.

What you will learn

  • How one report interval (4 s) becomes 21,600 points per vehicle per day, 10.8 billion writes a day and 125,000/s sustained - and why changing that interval is the biggest lever on the bill.
  • Why last-known position (75 MB, in memory, overwritten, not durable) and history (append-only, columnar) must be different stores.
  • How tiered retention - 7 days at 4 s, 90 days at 30 s, 5 years at 5 min - turns 215 TB compressed into about 4.8 TB, and why downsampling is irreversible.
  • Why ingest must never reject, and how idempotent writes on (vehicle_id, reported_at) make retries and offline back-fill safe.
  • Why the map viewport query uses geohash prefix ranges over a sorted set rather than S2 or H3.
  • Why alerts such as harsh braking must be evaluated on the stream, because they do not survive 30-second sampling.

How to read this board

  1. Diagram, top band, left to right: THE FIREHOSE (vehicle, gateway, accept-always, the ingest stream), then TWO DESTINATIONS, TWO LIFETIMES (last known vs history). Press play for the eight-step walkthrough.
  2. Middle band, WHAT IS KEPT: the downsampler, trip segmenter, stream rules and retention tiers - the decision worth 45x.
  3. Bottom band, WHO IS WATCHING: dispatcher, console, viewport query, live push and replay - 800 reads a second in total.
  4. Then the DATA MODEL: five tables, and the biggest one is not in Postgres.
  5. Page 1 · Requirements - the questions that change every number, and the never-reject ingest target.
  6. Pages 2 and 3 · Capacity and Storage - the one-line multiplication, then the tier-by-tier retention arithmetic.
  7. Page 4 · Availability - the gateway tier as the real single point of failure, and what degrades rather than dies.
  8. Page 5 · How it works - one point from device to map and history, then Page 6 · Deployment, including one-node-at-a-time gateway rollouts.

1 · Requirements

Half a million vehicles reporting continuously, and a handful of dispatchers looking at a map. The load and the product are on completely different scales, and the design is mostly about keeping them apart.

Ask these before designing

  • How often does a vehicle report, and who decides? 4 s, 10 s and 60 s are the same product and a 15x difference in every number on the capacity page. This is the first question and it is usually answered by a firmware default nobody revisits.
  • What is the history FOR? A map replay needs 30 s. A harsh-braking score needs 1 s. A collision reconstruction needs 10 Hz accelerometer data this board does not even carry. Downsampling is irreversible, so this question must be answered before ingest, not after.
  • Does the customer see live, or recent? "Live" means a push channel and a write path that cannot lag. "Within a minute" means a poll and a much cheaper system.
  • How long must data be kept, and by whom is that mandated? Tachograph and hours-of-service rules put a legal floor under retention that no amount of cost engineering may go below.
  • Is the vehicle ever offline? Long-haul trucks lose signal for hours. Either the device buffers and back-fills - which means out-of-order arrivals of thousands of points - or the history has holes. Both are real designs; only one of them is usually considered.
  • Per-customer retention, or one global policy? Per-customer is the right answer commercially and the expensive one architecturally, because it makes every partition boundary a per-tenant decision.

Functional

  • Ingest positions from 500,000 devices, tolerate duplicates and out-of-order back-fill.
  • Answer "where is every vehicle in this map viewport" in under 200 ms.
  • Push live position updates to open consoles.
  • Replay any vehicle’s track for any day within retention.
  • Segment the raw stream into trips (ignition on to ignition off) and daily rollups.
  • Raise alerts - speeding, geofence-adjacent, idling, harsh braking - from the stream rather than from the history.

Non-functional

  • Ingest must never reject. A device that cannot deliver retries, and 500,000 devices retrying together is the only real way to take this system down. Accept, acknowledge, and sort it out downstream.
  • Last-known position fresh within one report interval (4 s).
  • Viewport query p99 under 200 ms with up to 20,000 vehicles in frame.
  • Ingest availability 99.99%; console availability 99.9%. They are different numbers because dropping the map is an inconvenience and dropping the stream is a hole in a legal record.
  • Writes are idempotent on (vehicle_id, reported_at) - the only defence against back-fill that works.

Explicitly out of scope

Geofence evaluation and enter/exit events (that is the geofencing board), route planning and navigation, driver identity and payroll, video telematics, maintenance scheduling.

The rest of this board

Preview of the Fleet tracking system design board: 16 components joined by 18 connections. The labelled board opens in Tierslate.
Board preview

Available on Tier Slate

This page publishes the question. The answer — 5 more written pages, an 8-step narrated walkthrough and a 5-table schema — is the board itself, and it opens in Tierslate.

  • 5written pages
  • 8walkthrough steps
  • 5tables36 columns

5 pages behind this one

  • Capacity estimation
  • Storage estimation
  • Availability
  • How it works
  • Deployment plan
Open this board in TierslateBrowse every board

Related system design templates

Geospatial indexes, matching and moving things. 7 more location & logistics templates:

  • Geofencing system design - Teaches how a covering index reduces every-point-against-every-fence to a handful of tests, and why a jittery GPS makes the crossing itself the harder problem.
  • Maps routing system design - Teaches how a shortest path over a continental road graph is bought with precomputation, and what live traffic does to work that was done last night.
  • Proximity search system design - Teaches how to size a geospatial index against the query it serves, and why the nearest answer is usually in the cell next door.
  • Ride matching system design - Teaches how a geospatial index turns supply and demand into a dispatch decision, and why that decision is an assignment over a batch rather than a nearest-neighbour lookup.
  • Parking reservation system design - How spots are booked by time window without double booking, and what happens when a car overstays.
  • Package tracking system design - How carrier scan events become one shipment timeline, and why events arrive late and out of order.
  • Surge pricing system design - How supply and demand per map cell set a multiplier, and why the price must be locked when it is shown.
Open the Fleet tracking board in TierslateAll location & logistics templatesAll 100 system design templates
Tierslate

tierslate.com

HomeTemplatesGuidesCompareAboutUI mockupsPrivacyTerms