Skip to content

Allocation: Shared cache capacity monitor implemenation - #155646

Open
surya-estc wants to merge 6 commits into
elastic:mainfrom
surya-estc:rsb/monitor_cache_capacity_decider
Open

Allocation: Shared cache capacity monitor implemenation#155646
surya-estc wants to merge 6 commits into
elastic:mainfrom
surya-estc:rsb/monitor_cache_capacity_decider

Conversation

@surya-estc

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a stateless allocation monitor that watches per-node shared cache commitments (from ClusterInfo) and triggers allocation reroutes when search nodes newly cross the shared-cache capacity watermarks, along with a new dynamic throttle setting and accompanying unit tests.

Changes:

  • Introduces SharedCacheCapacityMonitor to detect high/low watermark transitions in node cache commitments and call RerouteService#reroute.
  • Wires the monitor into StatelessPlugin and exposes a new dynamic setting to rate-limit reroute requests.
  • Adds SharedCacheCapacityMonitorTests covering transition classification, reroute triggering rules, throttling, and live setting updates.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
x-pack/plugin/stateless/src/main/java/org/elasticsearch/xpack/stateless/allocation/SharedCacheCapacityMonitor.java New monitor implementation that evaluates cache commitment watermark transitions and triggers reroutes with throttling.
x-pack/plugin/stateless/src/main/java/org/elasticsearch/xpack/stateless/allocation/SharedCacheCapacityAllocationDecider.java Adds cluster.routing.allocation.shared_cache_capacity.reroute_interval setting used by the monitor.
x-pack/plugin/stateless/src/main/java/org/elasticsearch/xpack/stateless/StatelessPlugin.java Registers the new monitor as a ClusterInfoService listener and exposes the new setting via getSettings().
x-pack/plugin/stateless/src/test/java/org/elasticsearch/xpack/stateless/allocation/SharedCacheCapacityMonitorTests.java New unit tests validating monitor decisions, reroute triggering behavior, throttling, and dynamic settings updates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

surya-estc and others added 3 commits July 31, 2026 12:21
@surya-estc

Copy link
Copy Markdown
Contributor Author

@nicktindall

  1. Right now a new high-watermark or low-watermark transition inside the throttle interval is delayed because the monitor leaves lastNodeCommitments unchanged and lets a future ClusterInfo publication trigger the reroute after the throttle expires. That seems acceptable if we’re deliberately choosing a simple global minimum interval, since ClusterInfo should refresh soon anyway. Or, should we always bypass the throttle for any new transitions regardless of when the last reroute was triggered?

  2. After a successful reroute, if the same nodes remain over the high watermark and ClusterInfo does not materially change, this monitor will not reroute again just because reroute_interval elapsed. That seems reasonable to me because if the first reroute did not change the commitments, another reroute with the same inputs likely will not achieve anything. I just want to confirm that this is the intended behavior.

@surya-estc
surya-estc marked this pull request as ready for review July 31, 2026 23:08
@surya-estc
surya-estc requested a review from nicktindall July 31, 2026 23:08
@elasticsearchmachine elasticsearchmachine added the needs:triage Requires assignment of a team area label label Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:triage Requires assignment of a team area label v9.6.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants