tezvyn:

Scaling Prometheus for HA and volume

AI-drafted, machine-checkedSource: interviewadvanced
WHAT IT TESTS

scaling a single Prometheus past its limits.

OUTLINE

shard scraping, add long-term object storage and global query via Thanos/Cortex/VictoriaMetrics, run redundant replicas for HA, with dedupe.

WHAT THIS TESTS Whether you understand the two distinct problems, ingestion scale and durable plus global querying, and can reason about real solutions and their trade-offs rather than just adding RAM.

A GOOD ANSWER COVERS First, separate concerns. Scale ingestion by sharding: run multiple Prometheus instances, each scraping a subset of targets by team, service, or hashmod relabeling. Achieve high availability by running redundant scraper replicas with identical config so one can fail. Solve long-term storage and global queries with a horizontally scalable system. Thanos adds a sidecar to each Prometheus that ships blocks to object storage like S3, plus a Store Gateway and a Querier that fans out across instances and deduplicates HA replicas; it is operationally lighter and storage-cheap but query latency over object storage can be high. Cortex/Mimir is a clustered, multi-tenant write path that ingests remote_write into horizontally scalable ingesters and stores in object storage; very scalable and multi-tenant but more components to operate. VictoriaMetrics offers a simpler, resource-efficient cluster with strong compression and a single binary or a few components; easy to run and fast, with some PromQL dialect differences.

COMMON WRONG ANSWERS Just vertically scaling one instance, which only delays the failure. Skipping long-term storage. Running HA replicas but not deduplicating, so queries double-count. Ignoring multi-tenancy needs.

LIKELY FOLLOW-UPS How does deduplication work across HA replicas? What are the query-latency trade-offs of object storage? How do you handle downsampling for long retention?

ONE CONCRETE EXAMPLE An org sharding by team runs two replicas per shard for HA. Each Prometheus has a Thanos sidecar uploading 2-hour blocks to S3. A Thanos Querier presents one global view, deduplicating the replica pairs and merging recent in-memory data with historical blocks from the Store Gateway, giving both resilience and long retention without any single instance owning all the load.

Read the original → docs.victoriametrics.com

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.