Medium · IoT and devices
Smart power grid
A power company has 5 million smart meters. Each reports usage every 15 minutes, and they all try on the quarter hour. Customers see their usage, billing needs exact totals for seven years, and a regulator checks that records are kept safely. Control commands to home batteries and thermostats must never run twice. Practise this medium system design problem for free with a Google or GitHub account.
The brief
A power company has 5 million smart meters. Each reports usage every 15 minutes, and they all try on the quarter hour. Customers see their usage, billing needs exact totals for seven years, and a regulator checks that records are kept safely. Control commands to home batteries and thermostats must never run twice.
Think of a power company reading millions of smart meters.
Users, scale and requirements
- Who uses it
- 5 million meters, 3 million customers who look at usage (approx.)
- Audience in plain numbers
- 3,000,000 users or devices
- Normal peak
- ≈ 7,000 requests per second
- Request mix
- Telemetry batch: 78%; Analytics event: 8%; Read: 6%; Report: 3%; Write: 2%; Notification: 3%
- Speed for 99 of 100 requests
- Read: ≈ 500 ms; Report: ≈ 8,000 ms; Write: ≈ 500 ms
- Successful requests
- 99.9%
- Data safety
- No acknowledged write may be lost.
- Monthly budget
- ≈ $18,000
- Data at rest
- ≈ 12 TB
- Where users are
- North America: 100%
- Home region
- North America
- Waiting deadlines
- Telemetry batch: 3,600 seconds; Analytics event: 3,600 seconds; Read: 900 seconds; Report: 3,600 seconds; Write: 3,600 seconds; Notification: 900 seconds
- Minimum retained history
- 2,555 days on authoritative stores
- Required proofs
- Managed encryption keys; Audit trail; Tested backups; Retention rules
≈ marks an approximation, just as in the game. Waiting deadlines measure the age of queued work and are separate from interactive response time.
- Each reading is about 100 bytes; estimate long-term storage before adding copies.
- 5 million meters every 15 minutes is about 5,500 batches a second on average, and the quarter-hour waves are about 25 percent higher (approx.).
- All numbers are rough approximations.
- Scored data retention: at least 2555 days on active authoritative stores. Copies used only for search or reports can be rebuilt. Local device history and rollup policies still require the separate protocol check.
- 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
Can a meter reading be lost?
No. Readings are the basis of every bill. A meter keeps its readings and resends, so the same reading may arrive twice.
How long are readings kept?
Seven years for billing. The last 30 days must be fast to query; older data can be slow and cheap.
What happens during an outage?
When power returns, thousands of meters report at once. A short link failure between the substations and the cloud must not lose data.
What does the regulator check?
That every action is logged, data is encrypted with managed keys, backups exist and old records are kept for the required years.
The traffic day
Fairly steady traffic throughout the day. The clock covers 00:00 to 24:00 in the home region. Events add pressure on top of that normal traffic.
09:20 · Network partition
Your regions cannot talk to each other during the partition.
Duration: ≈ 300 seconds.
16:45 · Synchronized rush
Many callers send requests together instead of spreading them over time.
Traffic for Telemetry batch, Analytics event reaches 3 times the scheduled load; rises over 10 seconds, holds for 60 seconds and eases over 300 seconds. Other request types keep their scheduled load.
21:00 · Compliance audit
An auditor checks your design: who did what, encryption keys, personal data, backups and consent.
What a strong design has to handle
- Seven years of data is much more than any fast database should hold. How can old data move somewhere cheaper while the last month stays quick?
- Deduplicate meter intervals and fence control commands across retries.
- Hot storage costs roughly ten to a hundred times more than cold. Keeping only 30 days hot is the largest saving in the design.
- Four days of stream retention is enough to survive a weekend of trouble and costs little. One day is not.
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
- Medium
Insurance claims
After a hailstorm, thousands of drivers file claims online, each with a handful of photos. The storm offer ends at 5 pm, so everyone files at the last minute. Every claim must be saved safely, and every customer gets a confirmation email.
- Easy
Benefits application portal
People apply for food, health or housing help on a state site. Forms are long, people save drafts and upload documents, and a caseworker team reviews each one. The last week of the month is busy, and an auditor checks the privacy and access controls once a year.
- Hard
Tax filing deadline
A national tax site lets 30 million people file online. Most wait until deadline day, and traffic climbs all evening to a final-hour rush. People upload forms, check what they owe and pay. A mistake in a payment or a leak of tax data is a national story.
- Medium
Fleet telemetry
A freight company has 150,000 trucks that each send a batch of sensor readings every 30 seconds. Dispatchers watch live maps and analysts run reports. You must take in every batch, keep a month of detail cheaply, and survive the moments when thousands of trucks come back online at once.