System Design Hard Data Engineer Software Engineer Backend DevOps/SRE

Design a metrics aggregation and anomaly detection pipeline for IoT sensor data.

Practise this question with AI feedback

Record your spoken answer or type your response to receive immediate scoring and STAR improvements.

💡 Suggested Approach & Sample Answer

Architecture & Stream Processing Pipeline:
- Goal: Ingest sensor telemetry (temperature, vibration, pressure) from 500,000 IoT devices emitting readings every 2 seconds, detecting anomalies within 5 seconds.

1. Edge Protocol & Ingestion Gateway:
- Devices publish telemetry over lightweight MQTT / CoAP protocols to an MQTT broker cluster (e.g., EMQX) bridged to an API gateway.
- Ingestion gateway authenticates devices via mTLS (mutual TLS certificates), validates schema, and writes raw events into Kafka.

2. Real-Time Stream Processing & Anomaly Detection:
- Apache Flink / Spark Streaming consumes sensor streams using sliding time windows (e.g., 10-second tumbling windows).
- Runs statistical anomaly detection (Z-score, moving averages, or lightweight machine learning inference) against incoming sensor readings.
- If readings cross safety thresholds (e.g., vibration > 3 standard deviations), Flink immediately publishes an alert event to an urgent alerting topic.

3. Tiered Storage:
- Hot Tier: Time-series database (TimescaleDB / ClickHouse) storing recent high-resolution metrics for real-time dashboards.
- Cold Tier: Parquet files compacted and archived to S3 for deep analytical training and compliance auditing.

🎯 What Interviewers Listen For

How would you answer this in a real interview?

Use our free AI mock practice tool to test your response, analyze speaking pacing, and refine your STAR structure.

🧭 New to system design interviews?

Read the step-by-step system design interview guide: a 45-minute framework, the building blocks interviewers expect, and common mistakes.

🔗 Related System Design Questions