← Verkada Inc. Interview Insights
Start by clarifying requirements and scale (1M devices/min ≈ 16.7K events/sec), then propose a streaming pipeline with time-bucketed windows (e.g., 1-minute tumbling windows) and a distributed aggregation layer. Emphasize partitioning by device ID for even load, stateful processing with TTL for window state, and a serving layer that exposes per-status counts via a low-latency store like Redis.
Pro tip: Mention that you can pre-aggregate counts per status within each partition before merging, reducing data shuffling and enabling near real-time updates; also discuss using a time-series database or Redis sorted sets for efficient windowed counts.
Confirm the event rate (1M/min ≈ 16.7K/sec), latency requirements (real-time, likely sub-second), and whether exactly-once semantics are needed. Discuss the 10 status values and the need for per-minute counts.
Use a scalable message queue (e.g., Kafka) with partitions keyed by device ID to ensure ordered processing per device and even distribution. Consider batching to reduce overhead.
Apply tumbling windows of 1 minute (or sliding windows if needed) using a stream processor (e.g., Flink, Spark Streaming). Aggregate counts per status within each window, leveraging local pre-aggregation before global merge.
Store window state in a distributed store (e.g., RocksDB with Flink) with TTL to expire old windows. Use checkpointing and exactly-once semantics to handle failures; ensure idempotent updates for duplicates.
Write aggregated counts to a fast serving layer (e.g., Redis) keyed by window timestamp and status. Expose an API that reads the latest window counts, with caching and possibly pre-computed results for the previous minute.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.