Skip to content
System Designer

Medium · IoT and devices

Smart home

One million homes have a hub that keeps a live connection to your cloud. The hub reports its devices every few minutes, and the phone app sends commands like "lock the door". Commands must feel instant and must not be repeated. Once in a while a power cut ends and every hub reconnects together. Practise this medium system design problem for free with a Google or GitHub account.

The brief

One million homes have a hub that keeps a live connection to your cloud. The hub reports its devices every few minutes, and the phone app sends commands like "lock the door". Commands must feel instant and must not be repeated. Once in a while a power cut ends and every hub reconnects together.

Think of lights and locks controlled from a phone.

Users, scale and requirements

Who uses it
1 million homes and 2.5 million app users (approx.)
Audience in plain numbers
2,500,000 users or devices
Normal peak
≈ 5,000 requests per second
Request mix
Telemetry batch: 50%; Message: 12%; Read: 14%; Analytics event: 14%; Notification: 10%
Speed for 99 of 100 requests
Message: ≈ 300 ms; Read: ≈ 300 ms
Successful requests
99.8%
Data safety
At most 1 minute of writes may be lost.
Monthly budget
≈ $20,000
Data at rest
≈ 2 TB
Where users are
North America: 60%; Europe: 40%
Home region
North America
Waiting deadlines
Telemetry batch: 3,600 seconds; Message: 900 seconds; Read: 900 seconds; Analytics event: 3,600 seconds; Notification: 900 seconds
Personal reads
95% of reads are private; a shared public copy cannot answer them.

≈ marks an approximation, just as in the game. Waiting deadlines measure the age of queued work and are separate from interactive response time.

  • Each hub sends a batch of device states every few minutes.
  • A hub holds one open connection. A single gateway node holds about 100,000 connections.
  • All numbers are rough approximations.
  • Notification speed measures provider acceptance. Device receipt is outside this traffic model; check expiry, provider outcome and retries in the correctness trace before claiming delivery guarantees.

Questions that shape the design

How fast must a command feel?

A tap on the phone should switch the light in under a third of a second most of the time.

What if a command arrives twice?

A lock command twice is usually harmless, but "toggle the garage door" twice is not. Treat commands as one-time actions.

What happens if a whole region goes down?

Homes should connect to the other region within a couple of minutes, and commands should work again.

How many users are in Europe?

About a third. The rest are mostly in North America.

The traffic day

Consumer traffic, busiest in the evening. The clock covers 00:00 to 24:00 in the home region. Events add pressure on top of that normal traffic.

  1. 08:00 · Synchronized rush

    Many callers send requests together instead of spreading them over time.

    Traffic for Telemetry batch, Message, Read reaches 8 times the scheduled load; rises over 10 seconds, holds for 60 seconds and eases over 300 seconds. Other request types keep their scheduled load.

  2. 20:00 · Region outage

    A whole cloud region goes down.

    Duration: ≈ 7,200 seconds.

What a strong design has to handle

  • A hub keeps a connection open all day. What holds a million open connections without becoming the thing that breaks?
  • Deliver commands once with bounded validity across reconnects.
  • A second region costs about a third more and turns a region outage from hours of downtime into a short reconnect.
  • A key-value table is cheap per write and cannot answer complex questions. Keep a separate reporting copy for those.

Make a prediction, run a full traffic day, then compare the result. The in-game editorial opens after a finished day and includes measured reference designs.

Concepts to practise

Related problems