KatInterview

Storage Backend for a Large-Scale Time-Series Metrics Platform

System DesignModel answer
MediumModel answerSystem Designtime-seriesstoragepartitioning

Last updated

Design the storage layer for a metrics platform that ingests 100k points per second, serves tag-filtered time-range queries, downsamples older data and enforces tiered retention.

Build the Storage Layer for an Infrastructure Metrics Platform

Your team is building the storage tier behind an internal observability product. Thousands of microservices emit numeric measurements (CPU utilization, request counts, latency and so on). Engineers use the data for live dashboards, and an alerting engine reads it continuously.

What the system must do

  • Ingest about 100,000 data points per second, and remain available during node failures.
  • Query by time range (for example, "average CPU over the past hour") and by tags, with the ability to group results by tags such as host_id, service_name and region.
  • Downsample data once it is older than 24 hours, for example turning 1-minute samples into 1-hour aggregates, to save space.
  • Retain full-resolution data for 7 days and the coarser data for 30 days.

Assumptions

  • A point is a timestamp, a numeric value and a set of key-value tags.
  • Up to 1 million distinct tag combinations (series) can exist.
  • Points may arrive up to 5 minutes late.

What to cover in your answer

  1. Data model: how you represent metrics and tags so filtering is efficient.
  2. Storage technology: relational, NoSQL or a purpose-built time-series database, and why.
  3. Partitioning and indexing: how data is split to handle volume and keep reads fast.
  4. Downsampling: how and when older data is aggregated, and how the retention rules fit together.

Include back-of-the-envelope sizing and call out the trade-offs you are making.

Hints

Hint 1

Start with sizing: 100k points/s is roughly 8.6 billion points per day. Work out whether disk space or write throughput and index size is the real bottleneck once points are compressed.

Hint 2

Separate the identity of a series (metric name plus sorted tags) from its samples. Store tags once per series and use an inverted index from tag=value to series IDs, rather than repeating tags on every point.

Hint 3

Shard by series within immutable time blocks so retention becomes dropping whole blocks. For rollups, store sum, count, min and max per bucket so aggregates stay correct when merged, and only roll up data old enough that late arrivals can no longer touch it.