Katkat

Design a Camera Health Dashboard

VerkadaSoftware Engineer · Technical Screen

Last updated

This problem tests the ability to design a high-throughput ingestion system and a real-time state management strategy for time-sensitive IoT heartbeats.

System Design: Camera Health Dashboard

Design a backend system that monitors the health status of one million security cameras. Each camera sends a 'heartbeat' packet (a simple JSON payload containing camera_id and timestamp) every 10 seconds. The dashboard must display the real-time status of all cameras, specifically highlighting those that have not reported a heartbeat in the last 60 seconds as 'offline'.

Functional Requirements

  1. Ingest heartbeat events from 1,000,000 cameras.
  2. Expose an API endpoint GET /cameras/offline that returns the IDs of all cameras that have not checked in within the last 60 seconds.

Non-Functional Requirements

  1. The system must handle 100,000 heartbeats per second (based on the provided frequency).
  2. The offline status should be updated with no more than a few seconds of latency.
  3. The system should be resilient to transient network spikes.

Design Deliverables

  • Describe your data ingestion pipeline and storage strategy.
  • Explain how you determine the 'offline' set efficiently without scanning all one million records every time the API is called.
  • Discuss how you handle data expiration and potential bottlenecks at scale.

Hints

Hint 1

Consider using an in-memory data structure like a Redis Sorted Set where the score is the timestamp of the last heartbeat.

Hint 2

Decide whether a push-based model (writing to a database) or a pull-based model (active polling) is better suited for the 60-second window requirement.

Hint 3

Evaluate if you need a persistent database for the raw heartbeats, or if the dashboard state can live primarily in a fast, distributed cache.

Follow-up questions

  • How would you modify your design if you needed to provide a 24-hour historical uptime percentage for each camera?
  • If the heartbeat frequency increases from 10 seconds to 1 second, how does your ingestion architecture change to prevent system overload?
  • How would you handle a situation where a massive group of cameras go offline simultaneously (e.g., a regional power outage) to prevent a thundering herd problem on your dashboard?