Design a Distributed Metrics Aggregation
Design the system that collects metrics from every server and service in a large company and lets engineers graph them and alert on them. An agent on each host sends numbers such as request counts, latencies, CPU and queue depths, each tagged with labels like service, region and status. Engineers open dashboards that show the last hour or the last month, and alert rules check the data every 30 seconds and page someone when something is wrong.
The fleet is 500,000 hosts and containers, each reporting about 200 series every 10 seconds: 100 million active series and 10 million points a second, with peaks of 20 million. The hard parts are the shape of the data, not the request rate. Points must be written in order at a huge rate and compressed hard; memory is driven by how many distinct series exist, which one careless label can double; and a dashboard over 30 days must answer in under a second without reading billions of raw points. The system that tells everyone else they are down must itself stay up.
Good questions to ask first
Decide what you would assume for each before you look at ours.
- 1Push or pull?
- 2What kinds of metrics?
- 3How fresh must data be?
- 4How long do we keep data?
- 5Is losing a point acceptable?
- 6Can points arrive late or out of order?
- 7Is it multi-tenant?
- 8What query language?
How to spend the 45 minutes
- 5minPart 1: Requirements and scope
- 5minPart 2: Estimates: series, points, memory
- 5minPart 3: API and data model
- 15minPart 4: Architecture, stage by stage
- 15minPart 5: Deep dives: rollups, cardinality, alerting