KatInterview

Build a Multi-Tenant Time-Series Telemetry Backend

System DesignModel answer
MediumModel answerSystem Designsystem-designtime-seriesobservability

Last updated

Design a horizontally scalable telemetry backend that ingests millions of labeled data points per second, stores 30 days of history, and serves fast label-filtered range queries.

Build a Multi-Tenant Time-Series Telemetry Backend

Your organization wants an internal platform where services can report numeric measurements, such as CPU load, request totals, or latency distributions, and where engineers can chart them on dashboards. Design the backend. Alerting is explicitly out of scope.

What the platform must do

  • Accept measurements made up of a metric name, a timestamp, a numeric value, and a set of key-value labels (for example service=feed, region=us-east).
  • Support three kinds of metric:
    • Counters: values that only go up (they may reset on restart).
    • Gauges: point-in-time readings that can go up or down.
    • Histograms: distributions of observed values over time, such as request latencies.
  • Offer a query interface that returns trends over a chosen time window, with the ability to filter and group by labels.

Quality targets

  • Very high write throughput (millions of points per second) and low query latency.
  • At least 30 days of retention.
  • Horizontal scalability, high availability, and isolation between many tenants (teams).

What your answer should cover

  1. Capacity estimates that justify your choices.
  2. The write and query APIs.
  3. The data model and your choice of storage technology (purpose-built time-series store, columnar store, key-value store, etc.), with reasoning.
  4. The main components: ingestion pipeline, storage layer, and query engine.
  5. How you would cope with high label cardinality, for example a label that holds a unique user ID.

Be ready to discuss trade-offs and what happens when components fail.

Hints

Hint 1

Start from numbers: points per second, number of active series, and bytes per point after time-series compression. Storage and memory costs follow from series count and point count respectively.

Hint 2

Think about the access pattern: writes are almost always for the current moment, reads are time-range scans filtered by labels, and old data never changes. What storage layout does that favor?

Hint 3

Separate the problem into an index (labels to series) and the sample data (series to compressed chunks). Then consider which components handle recent data versus historical data.

Hint 4

Cardinality cost grows with the number of distinct label combinations, not the number of points. Consider limits, rejection, and aggregation at the edge.