SD-17 · Back to the write-up
Design a Server Metrics Collector
Agents push batches through a durable log into a compressed time-series store; rollups and a cache keep queries and alerts fast.
Follow a request
Write a batch
Dashboard refresh
30-day query
Alert fires
Deploy burst
Build rollups
Sources
Edge
Pipeline
Storage
AgentsOn 50,000 servers
EngineersDashboards
Ingest gatewaysQuotas, labels
Query serviceIndex, merge
Ingest log64 partitions
TSDB writersPer-series appends
Alert evaluator500,000 rules
NotifierGroup, dedupe
TSDB shards16 × 3, 15 days
Query cacheAligned steps
Object storageBlocks, rollups
Downsampler5 min, 1 hour
The numbers, at a glance
324 GB a day compressed13 TB a day as rows
259,200Raw
8,6405 min
7201 hour
1 dashboard query ≈ 1,000/s17 alert queries ≈ 16,700/s
A batch, in order
The agent gets 204 once the log has the batch; storage happens after.
Agent
Gateway
Ingest log
Writer
TSDB replicas
1 POST /v1/write (512 samples)
2 append, acks=all
3 stored on 3 brokers
4 204
5 consume partition
6 append WAL + head
7 2 of 3 confirm
8 commit offset
RequestResponseAsync, does not block
How samples reach storage
The decision this question is really about.
scrapers × N
GET host:9100
NAT, firewalls
+ Knows when a host is down.− Must reach 50,000 hosts across networks.
agent
INSERT 2.5M/s
store backs up
+ Few parts.− Bursts and slowness hit everyone.
agent batch
gatewaylog × 3
writers → TSDB
+ Absorbs bursts, replays after crashes.− More parts to run.
How it grows
Add a box only when a number forces you to. Highlighted boxes are new at each stage.
Agents
App server
SQL database
Agents
Load balancer
Gateways × 2Query service
TSDBSeries index
Agents
Load balancer
Gateways × 8Ingest logWriters
TSDB × 48Series indexObject storageDownsampler
AgentsEngineers
Gateways × 8Query serviceAlert evaluatorNotifier
Ingest logWritersQuery cache
TSDB × 48Object storage
Was this walkthrough useful?Your vote tells us what to improve next.