Reduce metrics store HTTP round-trips by batching per-task queries#2142
Draft
gareth-ellis wants to merge 2 commits into
Draft
Reduce metrics store HTTP round-trips by batching per-task queries#2142gareth-ellis wants to merge 2 commits into
gareth-ellis wants to merge 2 commits into
Conversation
Introduce private query-builder methods and static response parsers to EsMetricsStore, plus an msearch() method on both EsClient and EsMetricsStore. GlobalStatsCalculator dispatches to _call_batched() when the store supports msearch, collapsing all per-task queries (~14 per task) into a single _msearch HTTP call. Cluster-level metrics continue to use the sequential helpers so there is a single source of truth for those metric names. GlobalStats gains a cluster_name field for future multi-cluster use. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Whilst testing multi cluster work, we spotted it taking quite some time to generate results at the end of geonames - there is a large number of tasks, so even in test mode this took quite a while. This PR changes the approach, and speeds up quite significantly (276 seconds for a geonames run in test mode, including result generation, to 70 seconds after).
So as not to make the multi cluster PR even bigger, I am putting this here in draft, and can be looked at, rebased etc, after multi cluster is merged
Introduce private query-builder methods and static response parsers to EsMetricsStore, plus an msearch() method on both EsClient and EsMetricsStore. GlobalStatsCalculator dispatches to _call_batched() when the store supports msearch, collapsing all per-task queries (~14 per task) into a single _msearch HTTP call. Cluster-level metrics continue to use the sequential helpers so there is a single source of truth for those metric names. GlobalStats gains a cluster_name field for future multi-cluster use.