How does Grafana's LRU query cache handle cache key fragmentation from high-cardinality Prometheus labels?
0 reputation · 25 Jul 2025, 00:06 UTC
Cache Key Composition and Fragmentation
Grafana's query cache stores responses keyed by query text, time range, and template variables. With a default 10-second TTL and 10 MB per-data-source limit, high-cardinality labels like request_id or session_id generate numerous unique cache entries, causing fragmentation.
Eviction Policy Limitations
The LRU eviction policy lacks priority configuration or documented thresholds for fragmentation impact. Cache hit rates are not visible in the UI and require debug logging or scraping the undocumented /api/admin/stats endpoint.
Configuration and Monitoring Gaps
Administrators cannot reserve cache space for critical dashboards. Grafana 11's query editor changes may affect key generation, but this is not documented. The default cache size often proves insufficient for production workloads.
Can operators reliably determine when cache fragmentation begins degrading performance, and what monitoring approaches exist for production environments without exposing sensitive metrics?