Skip to content

[Data] Rate-based Cluster Autoscaler - #65954

Merged
goutamvenkat-anyscale merged 9 commits into
ray-project:masterfrom
rayhhome:port-rate-based
Sep 14, 2026
Merged

goutamvenkat-anyscale merged 9 commits into
ray-project:masterfrom
rayhhome:port-rate-based

Conversation

@rayhhome

@rayhhome rayhhome commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR implements the rate-based cluster autoscaler, which scales from observed execution throughput. It reads each operator's measured output rate and per-task resource requirements. It then solves for the bundle counts needed to sustain a higher throughput.

The rate-based cluster autoscaler has already been set as the default in RAY_DATA_CLUSTER_AUTOSCALER=RATE_BASED. Set this config to v2 to use the v2 Cluster Autoscaler (Note that v2 cluster autoscaler will become deprecated soon.

Additional information

Adds rate_based_cluster_autoscaler.py and the SupportsClusterAutoscaling protocol it depends on, and registers RATE_BASED in ClusterAutoscalerVersion.

Tests are 30 unit cases against stub operators, plus 3 end-to-end cases on real datasets so rates and bundle counts come from real OpRuntimeMetrics. Stubbing num_output_blocks_per_task_s to None leaves all 30 unit cases passing while the e2e tests fail.

@rayhhome rayhhome self-assigned this Sep 4, 2026
Copilot AI lite review requested due to automatic review settings September 4, 2026 23:09
@rayhhome
rayhhome requested a review from a team as a code owner September 4, 2026 23:09
@rayhhome rayhhome added data Ray Data-related issues go add ONLY when ready to merge, run all tests labels Sep 4, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a new RateBasedClusterAutoscaler for Ray Data, which dynamically scales up cluster resources based on per-operator throughput rates. It also adds comprehensive unit and end-to-end tests to verify its behavior. The review feedback highlights a few critical issues: a potential OverflowError when converting float infinity to an integer in the CPU padding logic, an incorrect variable reference in a shutdown warning message, and a hard assertion on output dependencies that could crash the executor during split operations.

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.

🟡 Changes recommended

There are a few correctness/clarity issues in newly added code (misleading shutdown warning timeout, typos, and inaccurate test type annotations) that should be fixed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Ports an internal rate-based Ray Data cluster autoscaler to open source by adding a new autoscaler implementation that scales from observed operator throughput (rates) rather than queued work, and wiring it into the existing cluster autoscaler factory/version selection.

Changes:

  • Add RateBasedClusterAutoscaler implementation and supporting SupportsClusterAutoscaling / ClusterAutoscalingMetrics protocols.
  • Register RATE_BASED in ClusterAutoscalerVersion and enable selection via RAY_DATA_CLUSTER_AUTOSCALER.
  • Add unit + end-to-end test suites and Bazel py_test targets for the new autoscaler.
File summaries
File Description
python/ray/data/_internal/cluster_autoscaler/rate_based_cluster_autoscaler.py New rate-based autoscaler implementation driven by measured throughput and utilization gates.
python/ray/data/_internal/cluster_autoscaler/supports_cluster_autoscaling.py New protocols defining the minimal operator surface required by the rate-based autoscaler.
python/ray/data/_internal/cluster_autoscaler/init.py Expose new autoscaler/protocols and add RATE_BASED selection path in create_cluster_autoscaler.
python/ray/data/tests/test_rate_based_cluster_autoscaler.py New unit tests using stub operators/coordinator to validate resource-request behavior and edge cases.
python/ray/data/tests/test_rate_based_cluster_autoscaler_e2e.py New e2e tests validating behavior against real execution metrics and object-store padding branch.
python/ray/data/BUILD.bazel Add Bazel test targets for the new unit and e2e test modules.
Review details

Suppressed comments (1)

python/ray/data/_internal/cluster_autoscaler/rate_based_cluster_autoscaler.py:535

  • The docstring has spelling errors ("direcly", "implicity") that make the comment harder to read and search for later.
        """Pad the resource request to implicitly request more object store memory.

        Ray doesn't let you direcly request more object store memory, so we need to
        implicity request object store memory by requesting more logical CPUs.
        """
  • Files reviewed: 6/6 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@rayhhome rayhhome changed the title [Data] Port Rate-based Cluster Autoscaler [Data] Rate-based Cluster Autoscaler Sep 10, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 46663fd. Configure here.

if self._is_cluster_utilization_low(utilization):
logger.debug("Cluster utilization is low -- skipping cluster autoscaling. ")
self._send_resource_request(self._last_resource_request)
return self._last_resource_request

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cold start never requests workers

High Severity

Init sends an empty request, then try_trigger_scaling resends _last_resource_request while utilization is below the gate. Startup utilization stays near zero until tasks run, and num_output_blocks_per_task_s is None until then, so _compute_bundle_counts (and its one-bundle liveness fallback) never runs. On a scale-from-zero cluster there is no remaining capacity to start work, so the new default autoscaler never issues demand and the job can stall.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 46663fd. Configure here.

has_incomplete_all_to_all = any(
isinstance(op, AllToAllOperator) and not op.has_completed()
for op in self._shuffle_ops
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hash shuffle skips object store padding

Medium Severity

HashShufflingOperatorBase is classified as a shuffle and excluded from rate-based bundle counts, but object-store padding only looks for AllToAllOperator. Joins, groupbys, and other hash-shuffle pipelines therefore never get the CPU padding used to add object store capacity when utilization is high.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 46663fd. Configure here.

@goutamvenkat-anyscale
goutamvenkat-anyscale merged commit dfee9b5 into ray-project:master Sep 14, 2026
5 of 6 checks passed
@rayhhome
rayhhome deleted the port-rate-based branch September 29, 2026 18:47
goutamvenkat-anyscale pushed a commit that referenced this pull request Sep 30, 2026
…or Rate-based Cluster Autoscaler (#66584)

## Description
`DefaultClusterAutoscalerV2` releases its resource request under
sustained low utilization (for example a straggler tail), so idle nodes
can be reclaimed. The rate-based cluster autoscaler lacks this and keeps
re-sending its last request
indefinitely, pinning nodes that nothing is using.

This PR strengthens the rate-based cluster autoscaler implementation by
adding the same mechanism. On low utilization the autoscaler keeps its
last non-empty request alive only for a grace window measured from when
that request was sent (`RAY_DATA_LOW_UTIL_REQUEST_RELEASE_DELAY_S`,
default 180s), then sends an empty request that keeps the requester
registered but drops the demand. It reuses V2's environment variable and
field names.

## Related issues
Related to #62592, which added this to `DefaultClusterAutoscalerV2`.
Adding feature to #65954.

## Additional information
Also includes unit tests for examining whether the mechanism is behaving
correctly. Not a duplicate: no open PR touches rate-based
low-utilization release.

Signed-off-by: Sirui Huang <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
## Description
This PR implements the rate-based cluster autoscaler, which scales from
observed execution throughput. It reads each operator's measured output
rate and per-task resource requirements. It then solves for the bundle
counts needed to sustain a higher throughput.

The rate-based cluster autoscaler has already been set as the default in
`RAY_DATA_CLUSTER_AUTOSCALER=RATE_BASED`. Set this config to `v2` to use
the v2 Cluster Autoscaler (Note that v2 cluster autoscaler will become
deprecated soon.

## Additional information
Adds `rate_based_cluster_autoscaler.py` and the
`SupportsClusterAutoscaling` protocol it depends on, and registers
`RATE_BASED` in `ClusterAutoscalerVersion`.

Tests are 30 unit cases against stub operators, plus 3 end-to-end cases
on real datasets so rates and bundle counts come from real
`OpRuntimeMetrics`. Stubbing `num_output_blocks_per_task_s` to `None`
leaves all 30 unit cases passing while the e2e tests fail.

---------

Signed-off-by: Sirui Huang <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…or Rate-based Cluster Autoscaler (ray-project#66584)

## Description
`DefaultClusterAutoscalerV2` releases its resource request under
sustained low utilization (for example a straggler tail), so idle nodes
can be reclaimed. The rate-based cluster autoscaler lacks this and keeps
re-sending its last request
indefinitely, pinning nodes that nothing is using.

This PR strengthens the rate-based cluster autoscaler implementation by
adding the same mechanism. On low utilization the autoscaler keeps its
last non-empty request alive only for a grace window measured from when
that request was sent (`RAY_DATA_LOW_UTIL_REQUEST_RELEASE_DELAY_S`,
default 180s), then sends an empty request that keeps the requester
registered but drops the demand. It reuses V2's environment variable and
field names.

## Related issues
Related to ray-project#62592, which added this to `DefaultClusterAutoscalerV2`.
Adding feature to ray-project#65954.

## Additional information
Also includes unit tests for examining whether the mechanism is behaving
correctly. Not a duplicate: no open PR touches rate-based
low-utilization release.

Signed-off-by: Sirui Huang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants