Design a Server Metrics Collector
Design a system that collects performance metrics, such as CPU, memory, disk, request rates and latencies, from every server a company runs. Engineers look at the numbers on dashboards, query them during incidents, and set alert rules that page someone when a value crosses a line, such as “CPU above 90% for 5 minutes”.
There are 50,000 servers, each reporting about 500 numbers every 10 seconds: 25 million live series and 2.5 million samples a second, with bursts of three times that after a fleet-wide deploy. The hard parts are taking that write rate without losing data, storing months of history cheaply, answering a 30-day dashboard in under a second, and evaluating 500,000 alert rules every 30 seconds, all while the system that tells you things are broken must itself stay up when things are broken.
Good questions to ask first
Decide what you would assume for each before you look at ours.
- 1How many servers and metrics?
- 2How often is a metric reported?
- 3Push or pull?
- 4How long is data kept?
- 5How fresh must data be?
- 6Is losing a few samples acceptable?
- 7Who queries it?
- 8Logs and traces?
How to spend the 45 minutes
- 5minPart 1: Requirements, retention and freshness
- 5minPart 2: Estimates: samples, bytes, queries
- 5minPart 3: API: write, query, rules
- 15minPart 4: Architecture, stage by stage
- 15minPart 5: Storage format, rollups, alerting