Skip to content

Conversation

@masseyke
Copy link
Member

@masseyke masseyke commented Jul 8, 2025

This fixes IndicesService.statsByShard() so that it no longer has O(N^2) performance (where N is the number of shards in the cache). It does this by pre-computing the total number of objects in the cache and the total number of shards represented in the cache, so that these don't have to be calculated for each shard.

Closes #97222

@masseyke masseyke added >bug :Data Management/Stats Statistics tracking and retrieval APIs v9.2.0 labels Jul 8, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @masseyke, I've created a changelog YAML for you.

@masseyke
Copy link
Member Author

This is related to #97222

@masseyke masseyke changed the title First attempt at improving statsByShard performance Improving statsByShard performance when the number of shards is very large Sep 26, 2025
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
9.2
8.19 Commit could not be cherrypicked due to conflicts
9.1 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 130857

@masseyke
Copy link
Member Author

masseyke commented Nov 7, 2025

💚 All backports created successfully

Status Branch Result
9.1
8.19

Questions ?

Please refer to the Backport tool documentation

masseyke added a commit to masseyke/elasticsearch that referenced this pull request Nov 7, 2025
…large (elastic#130857)

Co-authored-by: Joe Gallo <[email protected]>
(cherry picked from commit 22c15bc)

# Conflicts:
#	server/src/test/java/org/elasticsearch/indices/IndicesQueryCacheTests.java
elasticsearchmachine pushed a commit that referenced this pull request Nov 7, 2025
elasticsearchmachine pushed a commit that referenced this pull request Nov 7, 2025
…large (#130857) (#137768)

Co-authored-by: Joe Gallo <[email protected]>
(cherry picked from commit 22c15bc)

# Conflicts:
#	server/src/test/java/org/elasticsearch/indices/IndicesQueryCacheTests.java
Kubik42 pushed a commit to Kubik42/elasticsearch that referenced this pull request Nov 10, 2025
masseyke added a commit to masseyke/elasticsearch that referenced this pull request Nov 12, 2025
masseyke added a commit that referenced this pull request Nov 12, 2025
masseyke added a commit to masseyke/elasticsearch that referenced this pull request Nov 12, 2025
masseyke added a commit to masseyke/elasticsearch that referenced this pull request Nov 12, 2025
masseyke added a commit to masseyke/elasticsearch that referenced this pull request Nov 12, 2025
elasticsearchmachine pushed a commit that referenced this pull request Nov 12, 2025
elasticsearchmachine pushed a commit that referenced this pull request Nov 12, 2025
masseyke added a commit that referenced this pull request Nov 12, 2025
masseyke added a commit to masseyke/elasticsearch that referenced this pull request Nov 12, 2025
…is very large (elastic#130857)" (elastic#137973)

This reverts commit 22c15bc.

(cherry picked from commit e138f5f)

# Conflicts:
#	server/src/test/java/org/elasticsearch/indices/IndicesQueryCacheTests.java
masseyke added a commit that referenced this pull request Nov 13, 2025
…is very large (#130857)" (#137973) (#137993)

This reverts commit 22c15bc.

(cherry picked from commit e138f5f)
masseyke added a commit to masseyke/elasticsearch that referenced this pull request Nov 14, 2025
masseyke added a commit to masseyke/elasticsearch that referenced this pull request Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged backport pending >bug :Data Management/Stats Statistics tracking and retrieval APIs Team:Data Management Meta label for data/management team v8.19.8 v9.1.8 v9.2.2 v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Computing IndicesQueryCache stats is O(N²) in shard count

3 participants