cortex icon indicating copy to clipboard operation
cortex copied to clipboard

Opmize GetLabels and GetLabels values from store gateway

Open alanprot opened this issue 1 year ago • 3 comments

What this PR does: Right now, we wait the result from all store gateways be returned to only then Merge/Dedup the response.

This change is similar to what was done on: https://github.com/cortexproject/cortex/pull/5785

➜  ~ ~/go/bin/benchstat /tmp/old /tmp/new
goos: darwin
goarch: arm64
pkg: github.com/cortexproject/cortex/pkg/querier
                             │  /tmp/old   │              /tmp/new              │
                             │   sec/op    │   sec/op     vs base               │
BlocksStoreQuerier_Labels-10   3.013m ± 1%   2.147m ± 0%  -28.76% (p=0.002 n=6)

                             │   /tmp/old   │              /tmp/new               │
                             │     B/op     │     B/op      vs base               │
BlocksStoreQuerier_Labels-10   8.832Mi ± 0%   2.151Mi ± 0%  -75.64% (p=0.002 n=6)

                             │  /tmp/old   │             /tmp/new              │
                             │  allocs/op  │  allocs/op   vs base              │
BlocksStoreQuerier_Labels-10   20.06k ± 0%   19.84k ± 0%  -1.10% (p=0.002 n=6)

Which issue(s) this PR fixes: Fixes #

Checklist

  • [NA] Tests updated
  • [NA ] Documentation added
  • [NA] CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

alanprot avatar Mar 18 '24 22:03 alanprot

@alanprot Can we provide some kind of go benchmark results?

yeya24 avatar Mar 21 '24 03:03 yeya24

@yeya24 Update the PR to use the MergeSlicesParallel and added a bench.

It seems better but maybe we need more tests? like with different number of labels being returned?

alanprot avatar Mar 22 '24 22:03 alanprot

This issue has been automatically marked as stale because it has not had any activity in the past 60 days. It will be closed in 15 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 26 '25 17:04 stale[bot]