Design a Smart Meter System for Apartment Buildings
Collect a reading from every apartment's electricity meter each minute, show each tenant their own unit's usage, and show building managers floor and building totals, for any past period.
Problem statement
Design a system for smart electricity meters in apartment buildings. Each apartment unit has one meter. Every minute, each meter measures the electricity its unit used and reports it to a central service. Tenants and building managers look at the data on a website.
A tenant sees only their own unit's usage. A building manager sees usage for each floor and for the whole building, for every building they manage, but never a single unit's usage. Both can view usage by hour, day, week, month or year, for any period in the past.
For this exercise, assume one company runs this system for many apartment buildings. Each reading carries the meter's ID, the minute it covers and the watt-hours used in that minute. A meter sends a reading again if it does not get an acknowledgement, so the service can receive the same reading twice.
A meter that loses its connection keeps its readings and sends them when it reconnects. A tenant sees only usage from the time they have lived in the unit, not a previous tenant's. Hours, days and months follow the building's local time.
Billing, prices, turning power on or off, installing meters and the meter hardware are out of scope.
Design the system, from a meter's report to the charts on the website.
What to build
- Each unit's meter reports the electricity used in each minute to the central service, and a reading that arrives twice is counted once.
- A signed-in tenant sees their own unit's usage by hour, day, week, month or year for any past period of their tenancy, and no other unit's.
- A signed-in building manager sees usage per floor and for the whole building, for each building they manage, over the same kinds of periods, but never a single unit's usage.
At scale
- For this exercise, assume 200 buildings with 50,000 units in total, one meter per unit and one reading per meter each minute: about 830 readings per second, or 72 million readings a day.
- For this exercise, assume a new reading should appear on the website within 2 minutes, and any usage chart, up to a whole building over a year, should load within 1 second at p95.
- For this exercise, assume a meter that loses its connection keeps up to 24 hours of readings and sends them all when it reconnects.
- For this exercise, keep every minute reading for 1 year and hourly totals for 5 years.