Architect a solution for IoT device data ingestion and processing
Instruction: Design a system architecture for ingesting, processing, and analyzing data from millions of IoT devices in real-time.
Updated
Official answer
Translate the device count into traffic. One million devices sending once per minute produce about 16,667 messages/second on average; synchronized reconnects can be much larger. Estimate payload size, bursts, offline buffers and the required freshness before sizing components.
Authenticate devices with provisioned identities and revocable credentials at a suitable gateway or broker. Authorize topics/entities, bound message size and rate, validate schema and isolate malformed data. Do not treat a client-supplied device ID as proof of identity.
Use a durable ingestion log with partitioning that preserves the required per-device ordering without creating hot partitions. Include event ID or sequence, device/event time and server ingestion time. Device clocks can drift and sequence numbers can reset, so define reboot identity and deduplication scope.
Process bounded event-time windows with an explicit late/correction policy. Persist state, make outputs replay-safe and use backpressure and capacity limits. Store recent queryable results separately from retained source data where appropriate, with approved retention and recoverable metadata.
Test duplicate delivery, device reconnect bursts, out-of-order events, clock faults, credential revocation and region/broker failure. Monitor lag, rejection rates, state size, skew and tail latency. A queue acknowledgement is not proof that an analytical result is available, and a named distributed framework does not establish capacity for a million devices.