KatInterview

IoT Sensor Data Pipeline Architecture

System DesignModel answer
MediumModel answerSystem Designtime-seriesdata-ingestionIoT

Last updated

Design a distributed system to ingest and query temperature readings from millions of globally distributed IoT devices with high write throughput.

Problem

Design an architecture for collecting and analyzing temperature measurements from a global fleet of IoT devices. The system receives readings from 10 million sensors, with each device reporting its temperature every 10 seconds.

Your design must support:

Core Capabilities

  1. Data ingestion: Accept approximately 1 million temperature events per second on a sustained basis
  2. Current state lookup: Provide an endpoint that returns the most recent temperature for any given sensor
  3. Historical analysis: Provide an endpoint that computes aggregate statistics (average, minimum, maximum) for any sensor across a specified time window

Quality Attributes

  1. Scalability: Architecture should accommodate growth in sensor count without fundamental redesign
  2. Performance: Latest temperature queries must complete in under 100 milliseconds
  3. Resilience: Service should tolerate regional infrastructure failures

What to provide

  1. Textual description of your architectural components and their interactions
  2. API endpoint definitions for writing data and reading results
  3. Data schema design and technology selection for storage layers
  4. Approach to managing write throughput and data lifecycle

Event format Each measurement contains: {sensor_id: string, timestamp: long, temperature: float}

Calculate expected storage volumes as part of your design.

Hints

Hint 1

Start by calculating throughput, bandwidth, and storage requirements to ground your design in concrete numbers

Hint 2

Consider how time-series data differs from general-purpose data—compression ratios, query patterns, and specialized storage engines matter

Hint 3

Think about the trade-off between storing raw measurements versus pre-aggregated summaries for different time ranges