Repository navigation
[Data] Rate-based Cluster Autoscaler - #65954
Conversation
Signed-off-by: Sirui Huang <[email protected]>
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
🟡 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
RateBasedClusterAutoscalerimplementation and supportingSupportsClusterAutoscaling/ClusterAutoscalingMetricsprotocols. - Register
RATE_BASEDinClusterAutoscalerVersionand enable selection viaRAY_DATA_CLUSTER_AUTOSCALER. - Add unit + end-to-end test suites and Bazel
py_testtargets 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.
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
Signed-off-by: Sirui Huang <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
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 |
There was a problem hiding this comment.
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)
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 | ||
| ) |
There was a problem hiding this comment.
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)
Reviewed by Cursor Bugbot for commit 46663fd. Configure here.
dfee9b5
into
ray-project:master
…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]>
## 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]>
…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]>


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 tov2to use the v2 Cluster Autoscaler (Note that v2 cluster autoscaler will become deprecated soon.Additional information
Adds
rate_based_cluster_autoscaler.pyand theSupportsClusterAutoscalingprotocol it depends on, and registersRATE_BASEDinClusterAutoscalerVersion.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. Stubbingnum_output_blocks_per_task_stoNoneleaves all 30 unit cases passing while the e2e tests fail.