Skip to content

Reduce metrics store HTTP round-trips by batching per-task queries#2142

Draft
gareth-ellis wants to merge 2 commits into
masterfrom
improve-result-generation
Draft

Reduce metrics store HTTP round-trips by batching per-task queries#2142
gareth-ellis wants to merge 2 commits into
masterfrom
improve-result-generation

Conversation

@gareth-ellis

Copy link
Copy Markdown
Member

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.

gareth-ellis and others added 2 commits June 4, 2026 13:01
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant