80% faster, 70% less memory: Go tricks we used to build a high-performance Prometheus query engine
summary
Built a Prometheus‑compatible query engine for Grafana Mimir that benchmarks up to 80% faster and uses 70% lower peak memory, and that reduces real‑world memory spikes by streaming data series one at a time. Implementation specifics: streaming per-series execution so operators hold at most a couple of series, bucketed slice pooling to avoid allocations and GC, deferred []byte→string conversion to cut allocations (~5%) and latency (~2%), and per-query memory tracking to apply smarter limits — deployed and working in production.
AI-written summary · about
