Design a Device Status Collection Platform
Register millions of devices, collect retry-safe status reports and serve trustworthy latest-state and fleet aggregate queries.
Problem statement
Design a platform in which millions of devices register and upload status/info every ten minutes, and operators query collected state and fleet aggregates. For this exercise, assume three million devices belong to authenticated organizations. Registration gives each device one immutable type and stable device identity.
A report contains that device's persistent strictly increasing sequence, device timestamp, one of OK,DEGRADED or ERROR and a bounded info object. The sequence survives device restarts.
An accepted greater-sequence report durably advances latest reported state; within seven days identical retries replay their stored outcome, and conflicting reuse of a retained identity fails.
A sequence below the durable highest value with no recoverable receipt returns OLD_OR_EXPIRED and never rolls state back; this also covers a first delayed lower-sequence delivery. Do not infer an original acceptance after its receipt expires.
Authorized operators can inspect one device's latest reported status/info and both device-reported and server-accepted times. They can query counts of registered devices by type and latest reported status; a device with no accepted report is NEVER_REPORTED.
These are reported-state aggregates, not proof of current health: silence does not automatically change a device to failed or healthy. Counts are exact for their returned covered snapshot/watermark and expose age or unavailable state when processing lags.
Design registration and upload APIs, durable schema/ownership, ingestion, latest-state transitions, aggregation, query paths, replay/rebuild, overload and recovery. Remote commands, alerts, firmware, device identity/sequence resets and historical telemetry exploration are outside scope.
What to build
- An organization can idempotently register a device with stable identity and immutable type; duplicate conflicting registration is explicit.
- Devices can upload authenticated reports with seven-day stable receipt replay, retained identity conflicts and explicit OLD_OR_EXPIRED outcomes; only a greater persistent sequence can advance latest reported state.
- Authorized operators can retrieve latest reported status/info and its sequence/device timestamp/server acceptance time, including NEVER_REPORTED.
- Authorized operators can retrieve registered-device counts by type and latest reported status with a covered state watermark and explicit freshness or degraded outcome.
At scale
- For this exercise, assume three million registered devices and one report of at most 4 KiB every ten minutes: about 5000 reports/s steady with bursts to 20,000/s.
- For this exercise, serve 1000 operator queries per second within 2 seconds p95 and reflect accepted state changes in count projections within 60 seconds p95 during healthy operation.
- For this exercise, preserve authoritative registration/latest state through a single-zone failure and retain accepted transition evidence for seven days. Rebuild must start from a complete state snapshot and consume a retained complete tail, or restart from a newer snapshot. Retain upload outcomes for seven days; afterward a request at or below the durable highest sequence with no recoverable receipt is OLD_OR_EXPIRED and cannot change state.
- For this exercise, information fields are bounded and schema-versioned; current status and report age remain distinguishable from actual online health. A lagging aggregate must report its covered watermark instead of fabricating current completeness.