1. Tenants #
Complete logical isolation.
Principle #
In Mimir, every request carries a tenant identifier in the X-Scope-OrgID header. Data, rules, Alertmanager and limits are separated per tenant: a team never sees another team's series.
multitenancy_enabled: true # défautCommon mistake: Mimir does not authenticate: it trusts the header. In production, put a gateway in front of it (nginx, Envoy, Grafana Enterprise Metrics) that authenticates the client and then injects the right X-Scope-OrgID.Example nginx gateway #
map $remote_user $tenant {
equipe-web web;
equipe-data data;
}
server {
listen 80;
auth_basic "Mimir";
auth_basic_user_file /etc/nginx/htpasswd;
location / {
proxy_set_header X-Scope-OrgID $tenant;
proxy_pass http://mimir:8080;
}
}Multi-tenant queries #
With tenant_federation.enabled: true, a query can target several tenants: X-Scope-OrgID: web|data. The __tenant_id__ label then shows the origin of each series. Handy for a central SRE team.
2. Limits #
Protecting the cluster from abuse and mistakes.
Ingestion limits #
| Limit | Default | Meaning |
|---|---|---|
ingestion_rate | 10,000 | Samples/s per tenant |
ingestion_burst_size | 200,000 | Tolerated burst |
max_global_series_per_user | 150,000 | Active series per tenant (across the whole cluster) |
max_global_series_per_metric | 0 (unlimited) | Active series per metric name |
max_label_names_per_series | 30 | Number of labels per series |
max_label_value_length | 2048 | Length of a label value |
out_of_order_time_window | 0 | Window for accepting late samples |
Exceeding a limit results in 429 or 400 errors on the Prometheus side and in the cortex_discarded_samples_total{reason=...} metric on the Mimir side.
Common mistake: The default values are deliberately low. The first « bug » encountered in production is almost always per_user_series_limit: raise the limits of the tenant concerned rather than disabling the check.3. Runtime configuration #
Changing limits without restarting.
runtime.yaml #
# mimir.yaml
runtime_config:
file: /etc/mimir/runtime.yaml
period: 10s# runtime.yaml (relu toutes les 10 s)
overrides:
web:
ingestion_rate: 50000
ingestion_burst_size: 1000000
max_global_series_per_user: 2000000
data:
max_global_series_per_user: 500000
max_fetched_series_per_query: 100000
ingestion_tenant_shard_size: 6 # shuffle sharding : 6 ingesters seulementThe /runtime_config page shows the overrides in effect; /runtime_config?mode=diff shows what differs from the default values.
Shuffle sharding #
Without shuffle sharding, every tenant uses all ingesters and all queriers: a tenant sending a monstrous query slows everyone down. By assigning each tenant a random subset of instances (ingestion_tenant_shard_size, max_queriers_per_tenant, store_gateway_tenant_shard_size), the blast radius of a noisy tenant is limited.
Good practice: Start by measuring:cortex_ingester_active_seriesper tenant and the/ingester/tenantspage show who consumes what.
