Preparing your design workspace

Loading the problem and your latest saved attempt…

Design an Apartment Alarm System

Let residents arm and disarm their apartment's alarm, raise one alarm when a break-in is not disarmed in time, alert residents and the building's security staff within seconds, and notice panels that go silent.

Problem statement

Design an alarm system for apartment buildings.

For this exercise, assume each apartment has an alarm panel with door, window and motion sensors, and each building has security staff on duty around the clock who watch alarms in a desk app. A resident arms or disarms their apartment's alarm on the panel with a PIN, or in a phone app.

While the alarm is armed, a door or window opening or motion starts a 30-second entry delay so a resident who has just come home can disarm it.

If nobody disarms in time, the alarm goes off: the panel sounds its siren, the apartment's residents get a notification on their phones, and the alarm appears in the building's desk app. A guard acknowledges the alarm, checks the apartment and closes the alarm with a note.

Also assume panels reach a central service over the building's internet connection. Each panel reports that it is alive every 60 seconds, because a panel that has gone silent cannot raise an alarm. A panel keeps working on its own while its connection is down, stores its events, and sends them when it reconnects.

Fire and smoke alarms, cameras, calling the police and the panel hardware are out of scope.

Design the system, from a sensor trip to the people who must respond.

What to build

  1. A resident can arm or disarm their apartment's alarm on the panel or in the phone app, and both show the same current state.
  2. When a sensor trips while the alarm is armed and nobody disarms within 30 seconds, the system raises one alarm and notifies the apartment's residents and the building's security staff.
  3. A guard sees the building's open alarms, acknowledges one and closes it with a note, and the residents can see what happened.
  4. Security staff are told when a panel stops reporting, and the events a panel stored while offline are processed when it reconnects.

At scale

  • For this exercise, assume 500 buildings with 100,000 apartments in total. Each panel reports that it is alive every 60 seconds, about 1,700 reports per second, and sends about 20 sensor, arm and disarm events a day, about 2 million events a day. A few thousand alarms are raised a day.
  • For this exercise, assume a raised alarm must reach the residents' phones and the desk app within 10 seconds at p99, must never be lost, and one entry delay must raise at most one alarm.
  • For this exercise, assume arming or disarming from the app takes effect on the panel within 5 seconds, and a panel that has not reported for 3 minutes is shown as offline to security staff.
  • For this exercise, assume a panel can store 24 hours of events while offline, and alarm history is kept for 2 years.