# How to design IoT telemetry ingestion

Source: https://systemdesignsim.com/system-design/iot-telemetry

System design · Device streams, late events and reconnect bursts

Authenticate each device, append readings to a durable stream, and build queryable time buckets; assume 1 million devices reporting every 10 seconds, giving 100,000 events a second. This teaching design separates ingestion from dashboards so reconnects cannot silently overwrite newer readings.

Updated October 28, 2026 · 5 min read

[Take the ad click aggregator challenge](https://systemdesignsim.com/challenges/ad-click-aggregator)

![IoT Telemetry Ingestion architecture diagram](https://systemdesignsim.com/diagrams/iot-telemetry-system-design-diagram.svg)

Device events pass through authenticated ingestion and a durable stream before processors update query storage.

## The short version

* Size for the reconnect burst, not the average: buffered backlogs from a recovering region can add 60% on top of normal load.
* Every reading carries deviceId, bootId and sequence across retries. Deduplicate wherever a repeat would change a stored result.
* Keep event time and arrival time separate. A late reading goes in its original bucket, and a missing one is never a zero.
* Archive raw events, build the query view and evaluate alerts in independent consumers, so one slow store can't stop the others.

## Clarifying questions to ask first

* What are the devices measuring? (Assume periodic temperature and battery readings, not video, firmware downloads or a safety-critical control loop.)
* How long can devices disconnect? (Assume they buffer one hour locally, then send the backlog alongside current readings.)
* Must every reading survive? (Assume accepted events are stored durably, while a device with a full buffer may drop its oldest unsent readings and report the loss.)
* Who reads the data? (Assume each customer sees only their own fleet, with recent charts and an export of history.)

## Numbers that shape the design

These are interview assumptions, not measurements from an existing fleet.

| Quantity          | Assumption                                | Result                           |
| ----------------- | ----------------------------------------- | -------------------------------- |
| Normal rate       | 1 million devices, one reading every 10 s | 100,000 events/s                 |
| Raw payload       | 100,000/s × 200 bytes                     | 20 MB/s, about 1.73 TB/day       |
| Reconnect backlog | 10% of devices × 360 buffered readings    | 36 million events                |
| Backlog drain     | 36 million over 10 minutes                | +60,000 events/s                 |
| Recovery peak     | normal + drain                            | 160,000 events/s before headroom |

Storage excludes transport headers, replication and indexes, so budget each retained copy separately. A regional recovery is also a connection storm: event throughput doesn't size authentication or TLS work. [Backpressure](https://systemdesignsim.com/system-design/backpressure) and a [durable queue](https://systemdesignsim.com/system-design/distributed-message-queue) keep the backlog under control.

## API

```
POST /devices/{deviceId}/readings
{ bootId, sequence, observedAt, schemaVersion, measurements }

GET /devices/{deviceId}/readings?from=...&to=...&cursor=...
{ readings, nextCursor, latestArrivalAt }
```

Each device has its own revocable credentials and keeps the same event identity across retries. The server derives customer ownership from registration, never from a customerId in the payload, and checks ownership before any read. MQTT can carry the same envelope. A transport ack and a successful downstream write are different events; say which one the device gets, and who owns retries after it.

## Data model

Raw events go to object storage by customer, date and ingestion partition. Recent query rows are keyed by customer, device and time bucket, ordered by event time with a tie-breaker. The dedupe key is deviceId + bootId + sequence; the boot identifier stops a restarted counter looking like old events. A last-seen table holds both the newest reading and the latest arrival, each updated by its own ordering rule.

Aggregate rows hold interval, count, min, max and schema version. Keep raw values long enough to rebuild aggregates after a processor bug, and make deletion cover raw objects, query rows and summaries, not just the customer-facing index.

## High-level design

An ingestion gateway authenticates devices, checks envelope size, applies customer quotas with a retryable rejection, and appends accepted events to a durable stream. Separate consumers archive raw events, build the query view and evaluate alert rules; dashboards read the query view, never the stream.

Partition by device, which keeps one device's events together without a global order. Spread large customers across many partitions. Monitor each consumer's lag and oldest unprocessed event, and report freshness at the query layer, because a healthy gateway can sit in front of a broken processor and stale charts.

## Duplicates and late readings

A device retries when its ack is lost. Deduplicate before updating counts, or averages and alarm frequency drift upward, and keep dedupe state for the supported retry and replay window. AWS IoT documents QoS 1 delivery with retries until acknowledgement, and persistent sessions can redeliver unacknowledged messages (https\://docs.aws.amazon.com/iot/latest/developerguide/mqtt.html). That doesn't make your aggregate update exactly once.

A late reading belongs in its event-time bucket. Recompute that bucket and bump its version rather than filing the reading under today. Show gaps and delays on charts instead of filling them with plausible values.

## Reconnects and device isolation

Devices reconnect with jitter and cap backlog upload separately from current readings, otherwise a recovered site keeps its live data behind hours of history. Reserve capacity for current data, or use separate queues with a weighted drain. Per-device and per-customer limits stop one bad firmware release eating the fleet's budget. Quarantine invalid schema versions with diagnostics, without storing repeated copies of a giant rejected payload. Require pagination on large query windows and send bulk exports to the archive.

[The ad click aggregator challenge](https://systemdesignsim.com/challenges/ad-click-aggregator) models stream and processor capacity, not MQTT sessions, device credentials or event-time corrections. The numbers are teaching estimates; see the [methodology](https://systemdesignsim.com/methodology).

## Common traps

* Using arrival time for every chart. A reconnect then looks like a sudden physical event instead of delayed history.
* Treating a broker ack as an aggregate commit. Consumers can still fail, retry and apply the same input twice.
* Partitioning only by customer. One large deployment becomes a hot partition that idle consumers can't help, and one hot device can do the same while the fleet average looks fine.
* Keeping only averages. You can't repair a bad aggregation or explain which readings triggered an alert.
* Acknowledging data that exists only in memory when storage falls behind. Bound ingestion and show delayed acceptance instead.

## Follow-up questions interviewers ask

* "How would you recover a broken aggregate?" Replay raw events into a new version, compare totals, switch readers after validation.
* "What if a device clock is wrong?" Keep the supplied time, record arrival time and flag readings outside the allowed skew.
* "How do you revoke a stolen device?" Disable that one identity. A fleet-wide shared secret would mean replacing every device's credential.

## Frequently asked questions

### Does IoT telemetry require MQTT?+

No. MQTT suits constrained devices and long-lived connections, while HTTPS can be enough for periodic batches. Choose after defining connectivity, authentication, delivery and battery constraints.

### How do you avoid duplicate sensor readings?+

Keep a stable event identity across retries, usually device, boot session and sequence. Deduplicate where a repeated event would change a stored result.

### Should late events update old charts?+

Under this design's contract, yes. Apply them to their event-time bucket and publish a corrected version while retaining arrival time for diagnosis.

### Why keep raw telemetry as well as aggregates?+

Raw events allow audits, new aggregations and repair after processing errors. Retention costs money, so choose its duration explicitly.

## More system design guides

[All 76 guides](https://systemdesignsim.com/system-design)

* [Design a Distributed Message Queue](https://systemdesignsim.com/system-design/distributed-message-queue)
* [Backpressure explainedBackpressure](https://systemdesignsim.com/system-design/backpressure)
* [Design a RAG PipelineToken budgets, semantic cache](https://systemdesignsim.com/system-design/rag-pipeline)
* [Design a Top-K Trending ItemsStream windows, count-min sketches, candidate ranking](https://systemdesignsim.com/system-design/top-k-trending)
* [Design a Stock Exchange Order Matching System](https://systemdesignsim.com/system-design/stock-exchange-order-matching)
* [Design a WhatsApp-style Messaging](https://systemdesignsim.com/system-design/whatsapp)

## Now fix it yourself.

Run the design under real traffic and see what breaks first. No signup.

[Take the ad click aggregator challenge](https://systemdesignsim.com/challenges/ad-click-aggregator)
