Queries over 90 days in Grafana time out on Thanos. How do you make them fast?
AdvancedScenarioLong-Term Storage, Scale and Cost
Answer
Situation read → The Querier is pulling too many raw chunks from the store gateways.
What I'd do →
- Put the Query Frontend in front: split by day and cache results.
thanos query-frontend --query-range.split-interval=24h --query-range.response-cache-config-file=memcached.yml - Enable automatic downsampling on the Querier (
--query.auto-downsampling) so 90-day queries use 1h data. - Add memcached/Redis index and chunk caches to store gateways.
- Shard store gateways by time or block hash so each holds a smaller index.
- Replace heavy panel queries with recording rules.
- Set a sensible Grafana min interval (e.g.
1hon long-range dashboards).
Why → Long-range queries need fewer, pre-aggregated points, not more CPU.
Interview tip → Check thanos_bucket_store_series_data_touched to prove where the cost comes from.
More on Long-Term Storage, Scale and Cost
Prometheus keeps 15 days of data, but leadership wants 13 months of metrics for capacity planning. What do you build?IntermediateThe Thanos compactor has halted and the bucket keeps growing. What do you do?AdvancedGrafana shows every series twice after you added a second Prometheus replica with Thanos. How do you fix it?IntermediateRemote write to your central store is falling further behind every hour. How do you handle it?AdvancedMimir rejects writes from a team with `err-mimir-max-series-per-user`. What do you do?IntermediateYour observability SaaS bill tripled in a quarter, driven by custom metrics. How do you bring it down?Intermediate