Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't hold labels from store-gateways in two forms, and don't convert them multiple times #9914

Merged
merged 4 commits into from
Nov 18, 2024

Conversation

charleskorn
Copy link
Contributor

@charleskorn charleskorn commented Nov 15, 2024

What this PR does

Previously, queriers would hold two copies of the labels for each series from a store-gateway: once as a []mimirpb.LabelAdapter (in the storepb.StreamingSeries held by blockStreamingQuerierSeriesSet) and again as a labels.Labels (passed to newBlockStreamingQuerierSeries). This means that queries that select many series use twice as much memory as they need to for labels, which can be problematic for queries that select many series with many labels.

This PR modifies the behaviour of queriers to only hold the labels as a labels.Labels instance.

It also fixes the issue where []mimirpb.LabelAdapter instances are converted to labels.Labels multiple times when streaming chunks: once when applying the series limiter, and again for use when iterating through series. Multiple conversions are still used when not streaming chunks, but given this is not the default behaviour and fixing this would be a more complex change, I've chosen to leave it as-is.

Which issue(s) this PR fixes or relates to

(none)

Checklist

  • Tests updated.
  • [n/a] Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • [n/a] about-versioning.md updated with experimental features.

@charleskorn charleskorn changed the title Don't hold labels from store-gateways in two forms Don't hold labels from store-gateways in two forms, and don't convert them multiple times Nov 15, 2024
@charleskorn charleskorn force-pushed the charleskorn/dont-hold-labels-twice branch from 9fda371 to 5efdf1c Compare November 15, 2024 06:28
@charleskorn charleskorn marked this pull request as ready for review November 15, 2024 06:41
@charleskorn charleskorn requested a review from a team as a code owner November 15, 2024 06:41
@charleskorn charleskorn merged commit d2367de into main Nov 18, 2024
29 checks passed
@charleskorn charleskorn deleted the charleskorn/dont-hold-labels-twice branch November 18, 2024 01:57
charleskorn added a commit that referenced this pull request Nov 18, 2024
… them multiple times (#9914) (#9930)

* Don't hold labels from store-gateways in two forms

* Don't retain labels longer than needed

* Don't convert mimirpb.LabelAdaptors to labels.Labels multiple times

* Add changelog entry

(cherry picked from commit d2367de)

Co-authored-by: Charles Korn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants