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

Option to include quorum zone results for DistributorQueryable metadata API #5779

Merged
merged 8 commits into from
Feb 21, 2024

Conversation

yeya24
Copy link
Contributor

@yeya24 yeya24 commented Feb 21, 2024

What this PR does:

Added a new flag -distributor.zone-results-quorum-metadata to only include quorum number of zones as query results of metadata APIs like label names, values and series.

This helps improve performance and latency. Image we have 3 zones. Now when zone awareness is enabled, we wait for all ingester results from at least 2 zones to be received before returning the results. However, for results from the 3rd zone, we are still trying to merge them. This can be inefficient as the results from 3rd zone are basically duplicates.

Thus, this pr tries to only use results from 2 zones. By having less data to merge, improve the latency as well as memory usage.

Which issue(s) this PR fixes:
Fixes #

Checklist

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

Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Comment on lines 86 to 89
if _, ok := resultsPerZone[res.instance.Zone]; !ok {
resultsPerZone[res.instance.Zone] = make([]interface{}, 0, len(r.Instances))
}
resultsPerZone[res.instance.Zone] = append(resultsPerZone[res.instance.Zone], res.res)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to have 2 new methods on the tracker interface to hide this logic?

  • tracker.RecordResult(instance, result)
  • GetQuerumResults
    • That for sone aware will return only the zonal results?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. I combine RecordResult to the existing done method.
GetResults is a general method to return results. Quorum or not is controlled via the flag

Signed-off-by: Ben Ye <benye@amazon.com>
@alanprot
Copy link
Member

LGTM!! Nice work!

Signed-off-by: Ben Ye <benye@amazon.com>
@yeya24 yeya24 enabled auto-merge (squash) February 21, 2024 22:38
@yeya24 yeya24 merged commit 0ecf317 into cortexproject:master Feb 21, 2024
16 checks passed
@yeya24 yeya24 deleted the zone-results-quorum branch February 21, 2024 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants