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

Caching total number of primary shards per node for evaluating constraints on avg primary shards across all indices per node #14992

Merged
merged 1 commit into from
Jul 31, 2024

Conversation

RS146BIJAY
Copy link
Contributor

@RS146BIJAY RS146BIJAY commented Jul 29, 2024

Description

Allocation constraints specify conditions which, if breached, reduce the priority of a node for receiving unassigned shard allocations. When evaluating the cluster constraint on avg primary shards across all indices per node, we calculate total number of primary shards on a node by summing up the shard count of all indices on the node. Since this computation is performed for each node during shard allocation, it becomes computationally expensive. As there is only single thread on master node which handles all the operations including the deciders and make allocation decisions, allocation deciders execution may continue to block these threads which may prevent execution of certain high priority tasks like applying/sending cluster state update, index create, etc.

Screenshot 2024-07-29 at 6 33 10 PM

This PR does an offline calculation of total shards of all indices on a node and caches it so that AllocationConstraint does not needs to traverse all the indices metadata during constraint evaluation.

Issue Resolved

#15114

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…on avg primary shards across all indices per node

Signed-off-by: RS146BIJAY <[email protected]>
Copy link
Contributor

✅ Gradle check result for 2ff7a54: SUCCESS

Copy link

codecov bot commented Jul 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.89%. Comparing base (1fe58b5) to head (2ff7a54).
Report is 6 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #14992      +/-   ##
============================================
+ Coverage     71.78%   71.89%   +0.10%     
- Complexity    62694    62794     +100     
============================================
  Files          5160     5161       +1     
  Lines        294211   294366     +155     
  Branches      42553    42579      +26     
============================================
+ Hits         211212   211635     +423     
+ Misses        65599    65291     -308     
- Partials      17400    17440      +40     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@RS146BIJAY RS146BIJAY marked this pull request as ready for review July 29, 2024 13:08
@RS146BIJAY RS146BIJAY changed the title Caching number of primary shards per node for evaluating constraints on avg primary shards across all indices per node Caching total number of primary shards per node for evaluating constraints on avg primary shards across all indices per node Jul 29, 2024
@Bukhtawar Bukhtawar added the backport 2.x Backport to 2.x branch label Jul 31, 2024
@Bukhtawar Bukhtawar merged commit 4707885 into opensearch-project:main Jul 31, 2024
64 of 66 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 31, 2024
…on avg primary shards across all indices per node (#14992)

Signed-off-by: RS146BIJAY <[email protected]>
(cherry picked from commit 4707885)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
andrross pushed a commit that referenced this pull request Jul 31, 2024
…on avg primary shards across all indices per node (#14992) (#15045)

(cherry picked from commit 4707885)

Signed-off-by: RS146BIJAY <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
harshavamsi pushed a commit to harshavamsi/OpenSearch that referenced this pull request Aug 20, 2024
…on avg primary shards across all indices per node (opensearch-project#14992)

Signed-off-by: RS146BIJAY <[email protected]>
wdongyu pushed a commit to wdongyu/OpenSearch that referenced this pull request Aug 22, 2024
…on avg primary shards across all indices per node (opensearch-project#14992)

Signed-off-by: RS146BIJAY <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants