Repository navigation
[Data] Fix autoscaler bug that blocks timely release of leased resources - #62592
Conversation
Fix a Ray Data request-refresh bug where low-utilization paths sent get_allocated_resources() as explicit resource requests. That pinned explicit demand and prevented the cluster autoscaler from releasing leased resources in a timely manner until dataset completion. This caused avoidable cluster over-allocation and resource waste under prolonged low-utilization periods. Keep the last non-empty explicit resource request only for a bounded grace window, then send an empty explicit resource request so the cluster autoscaler can release leased resources earlier. Signed-off-by: dragongu <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request introduces a grace period for releasing resource requests in the Ray Data autoscaler. When resource utilization drops below the scale-up threshold, the autoscaler now maintains the last explicit resource request for a configurable duration (defaulting to 180 seconds) before releasing it. This change prevents immediate drops in autoscaler demand and avoids re-submitting allocated resources as explicit demand during brief periods of low utilization. The implementation includes state tracking for the last non-empty request and its timestamp, along with new unit tests to verify the grace period behavior. I have no feedback to provide.
iamjustinhsu
left a comment
There was a problem hiding this comment.
nice job 👏 catching this!! I left some questions/comments/suggestions but overall looks good
Signed-off-by: dragongu <[email protected]>
…ces (ray-project#62592) ## Description This PR fixes a Ray Data bug that **blocked timely release of leased resources** by the cluster autoscaler. Previously, when utilization dropped below the scale-up threshold, `DefaultClusterAutoscalerV2` **sent** `get_allocated_resources()` as **explicit resource requests**. That kept explicit demand pinned and prevented the cluster autoscaler from releasing leased resources in a timely manner until dataset completion, causing avoidable over-allocation and waste. The new behavior is: - Keep the last non-empty explicit resource request only for a bounded grace window. - After the grace window, send an empty explicit resource request (`[]`) while keeping requester registration alive, so the cluster autoscaler can release leased resources earlier. This is implemented by tracking the last non-empty explicit resource request and timestamp, and by introducing `RAY_DATA_LOW_UTIL_REQUEST_RELEASE_DELAY_S` (default `180s`). ## Related issues N/A (no public issue linked) ## Additional information ### Files changed - `python/ray/data/_internal/cluster_autoscaler/default_cluster_autoscaler_v2.py` - `python/ray/data/tests/test_default_cluster_autoscaler_v2.py` ### Validation - Added regression tests for: - in-grace retention of the last explicit resource request - post-grace sending of an empty explicit resource request --------- Signed-off-by: dragongu <[email protected]>
…ces (ray-project#62592) ## Description This PR fixes a Ray Data bug that **blocked timely release of leased resources** by the cluster autoscaler. Previously, when utilization dropped below the scale-up threshold, `DefaultClusterAutoscalerV2` **sent** `get_allocated_resources()` as **explicit resource requests**. That kept explicit demand pinned and prevented the cluster autoscaler from releasing leased resources in a timely manner until dataset completion, causing avoidable over-allocation and waste. The new behavior is: - Keep the last non-empty explicit resource request only for a bounded grace window. - After the grace window, send an empty explicit resource request (`[]`) while keeping requester registration alive, so the cluster autoscaler can release leased resources earlier. This is implemented by tracking the last non-empty explicit resource request and timestamp, and by introducing `RAY_DATA_LOW_UTIL_REQUEST_RELEASE_DELAY_S` (default `180s`). ## Related issues N/A (no public issue linked) ## Additional information ### Files changed - `python/ray/data/_internal/cluster_autoscaler/default_cluster_autoscaler_v2.py` - `python/ray/data/tests/test_default_cluster_autoscaler_v2.py` ### Validation - Added regression tests for: - in-grace retention of the last explicit resource request - post-grace sending of an empty explicit resource request --------- Signed-off-by: dragongu <[email protected]>
…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]>
…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 fixes a Ray Data bug that blocked timely release of leased resources
by the cluster autoscaler.
Previously, when utilization dropped below the scale-up threshold,
DefaultClusterAutoscalerV2sentget_allocated_resources()as explicitresource requests. That kept explicit demand pinned and prevented the
cluster autoscaler from releasing leased resources in a timely manner until
dataset completion, causing avoidable over-allocation and waste.
The new behavior is:
window.
[])while keeping requester registration alive, so the cluster autoscaler can
release leased resources earlier.
This is implemented by tracking the last non-empty explicit resource request and
timestamp, and by introducing
RAY_DATA_LOW_UTIL_REQUEST_RELEASE_DELAY_S(default
180s).Related issues
N/A (no public issue linked)
Additional information
Files changed
python/ray/data/_internal/cluster_autoscaler/default_cluster_autoscaler_v2.pypython/ray/data/tests/test_default_cluster_autoscaler_v2.pyValidation