Interview Prep/Monitoring & Observability/Long-Term Storage, Scale and Cost

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 →

  1. 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
    
  2. Enable automatic downsampling on the Querier (--query.auto-downsampling) so 90-day queries use 1h data.
  3. Add memcached/Redis index and chunk caches to store gateways.
  4. Shard store gateways by time or block hash so each holds a smaller index.
  5. Replace heavy panel queries with recording rules.
  6. Set a sensible Grafana min interval (e.g. 1h on 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.

All Monitoring & Observability questions

More on Long-Term Storage, Scale and Cost