RousselTMLEARNING

Observability

Why Grafana Mimir? Architecture and deployment modes

The limits of Prometheus alone, what Mimir brings (long-term storage, high availability, multi-tenancy), its components and its deployment modes.

1. The limits of Prometheus alone #

Why a distributed metrics store.

One server, one disk #

Available in: ✓ OSS ✓ Enterprise ✓ Cloud Mimir open source, Enterprise Metrics and Grafana Cloud Metrics

Prometheus is excellent for collecting and alerting, but it was designed as a standalone server: its data lives on its local disk, its capacity is bounded by a single machine and each instance only sees what it collects.

NeedPrometheus aloneWith Mimir
Retention of several yearsExpensive local disk, no downsamplingCheap object storage, per-tenant retention
High availabilityTwo replicas with slightly different dataHA deduplication at ingestion, ×3 replication
Global viewOne instance = one scopeAll sources in a single PromQL API
Several teamsOne instance per teamNative multi-tenancy with per-tenant limits
Hundreds of millions of seriesImpossible on one nodeHorizontal scalability of each component

Mimir in one sentence #

Grafana Mimir is a distributed, Prometheus-compatible time series database: it receives metrics via remote_write (or OTLP), stores them as TSDB blocks in object storage and serves them through the Prometheus HTTP API. Grafana queries it like a regular Prometheus data source.

Good to know: Mimir was born in 2022 as a fork of Cortex by Grafana Labs, under the AGPLv3 license. It keeps its architecture (hash ring, ingesters, store-gateway) with many optimizations: partitioned compactor, faster query engine, and an ingestion path decoupled by Kafka in recent versions.

2. The components #

Each component has a single role and scales separately.

Overview #

Grafana Mimir architecture
Ingesters keep the last 2 hours in memory and then upload blocks; older data is read by the store-gateway.
ComponentPathRole
distributorwriteValidates samples, applies limits, deduplicates HA pairs and distributes series to the ingesters
ingesterwrite / readKeeps recent data in memory (WAL on disk), produces 2h blocks and uploads them
query-frontendreadSplits long queries, caches results, queues requests
query-schedulerreadShared queue between query-frontends and queriers (optional)
querierreadEvaluates PromQL by querying ingesters (recent) and store-gateways (history)
store-gatewayreadExposes blocks from object storage, with index-headers and caches
compactorbackgroundMerges and deduplicates blocks, applies retention, maintains the bucket index
rulerbackgroundEvaluates recording and alerting rules per tenant
alertmanagerbackgroundMulti-tenant Alertmanager, configured through the API

The hash ring #

Components that share a load (distributors, ingesters, store-gateways, compactors, rulers) coordinate through a hash ring. Each instance owns tokens in it; the hash of a series (tenant + labels) designates the responsible ingesters. The ring is stored in memberlist (gossip, the default), Consul or etcd.

Good practice: Keep memberlist: it needs no external dependency. Just open the gossip port (7946 by default) between the Mimir pods.

3. Deployment modes #

A single binary, several ways to run it.

Monolithic or microservices #

All components are in the same binary. The -target parameter chooses what a process runs.

ModeStartupFor whom
Monolithic-target=all (default)Tests, small installations, labs; several identical replicas can be run
Microservices-target=distributor, -target=ingester...Production: each component scales according to its load (Helm chart mimir-distributed)
# Monolithique : tous les composants dans un processus
mimir -config.file=/etc/mimir.yaml -target=all

# Un seul composant
mimir -config.file=/etc/mimir.yaml -target=ingester
Good to know: Recent versions of Mimir offer the « ingest storage » architecture: distributors write to Kafka (or a compatible equivalent) and ingesters consume this log. Reads and writes are thus decoupled: a burst of queries no longer slows down ingestion. The block storage principle remains the same; it is the one described in this course.

Ports and endpoints to know #

EndpointUsage
/api/v1/pushReceiving Prometheus remote_write
/otlp/v1/metricsReceiving OTLP (OpenTelemetry)
/prometheus/api/v1/queryPrometheus-compatible query API (Grafana datasource URL: http://mimir:8080/prometheus)
/prometheus/config/v1/rulesRuler API
/alertmanagerAlertmanager interface and API
/ready, /metrics, /configHealth, internal metrics, effective configuration
/ingester/ring, /distributor/ha_trackerStatus pages for the ring and the HA tracker

Related articles

The LGTM stack (Loki, Grafana, Tempo, Mimir): architecture and setup

Understand Grafana Labs' LGTM stack: Loki for logs, Grafana for visualization, Tempo for traces and Mimir for…

Mimir: the write path (distributor, ingesters, replication and HA deduplication)

How Mimir ingests metrics: remote_write, distributor validation and limits, hash ring, ingester replication, …

Mimir: the read path (query-frontend, querier, store-gateway and caches)

How Mimir answers a PromQL query: query-frontend splitting and caching, queue, queriers, store-gateway, index…

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!