Capacity Planning
Design a metrics monitoring system. Millions of hosts and services emit numeric measurements — request rates, latencies, queue depth, error counts — and engineers watch them on dashboards and get paged when something breaks.
In scope: ingesting metric points from many sources, storing them as queryable time-series, answering range queries for dashboards, and evaluating alert rules that page someone. Out of scope: log aggregation and distributed tracing (different systems with different storage models), the dashboard visualization frontend, and machine-learning anomaly detection.
Scale and usage:
Using the scale in the widget above as a working example: 1 million hosts, each emitting 100 metrics sampled every 10 seconds, is 100 million active series. At one sample every 10 seconds that's 6 points/minute per series, so 100M × 6 / 60 ≈ 10M points/sec — a firehose on the order of ten million points every second. Assume roughly 2 bytes per compressed raw point. Facebook's Gorilla time-series compression paper reports about 1.37 bytes/point in production, using delta-of-delta timestamps and XOR'd value compression; real ratios vary by encoding and data shape. At 2 bytes/point that's about 10M × 86400 × 2 bytes ≈ 1.7 TB/day of raw data. Keeping raw for a year would be around 620 TB and a single long-range dashboard panel would scan billions of raw points. A 1-day rollup answers the same year-long query by reading one point per series per day instead — 365 points per series over the year, versus roughly 3.15 million raw points each. Read load has a less obvious source: it's not mostly dashboards. A hundred thousand alert rules, each evaluated every 15 seconds, is 100,000 / 15 ≈ 6,700 rule-evaluations per second — often more read pressure on the store than humans looking at panels ever generate.
Key idea. Rollups and retention bound this system: without them, storage tracks the firehose forever and every long-range query scans raw points; with them, storage is capped per tier and each query reads only the coarsest resolution that still answers it.
What a strong answer sounds like
State the decision, connect it to a requirement, and name the tradeoff. Ask the interviewer for any product facts you need (users, usage, scale, targets) — they will answer. Keep the design focused on the workload.
The AI interviewer asks about this part of Design a Metrics Monitoring System. The interviewer guides you through topics one by one.