Skip to content

[Data] Fix autoscaler bug that blocks timely release of leased resources - #62592

Merged
bveeramani merged 2 commits into
ray-project:masterfrom
dragongu:fix/default_cluster_autoscaler_v2
Apr 15, 2026
Merged

bveeramani merged 2 commits into
ray-project:masterfrom
dragongu:fix/default_cluster_autoscaler_v2

Conversation

@dragongu

Copy link
Copy Markdown
Contributor

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

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]>
@dragongu
dragongu requested a review from a team as a code owner April 14, 2026 03:53

@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 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.

@ray-gardener ray-gardener Bot added data Ray Data-related issues community-contribution Contributed by the community labels Apr 14, 2026

@iamjustinhsu iamjustinhsu 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.

nice job 👏 catching this!! I left some questions/comments/suggestions but overall looks good

Signed-off-by: dragongu <[email protected]>
@bveeramani
bveeramani enabled auto-merge (squash) April 15, 2026 19:31
@github-actions github-actions Bot added the go add ONLY when ready to merge, run all tests label Apr 15, 2026
@bveeramani
bveeramani merged commit ba63f26 into ray-project:master Apr 15, 2026
4 checks passed
HLDKNotFound pushed a commit to chichic21039/ray that referenced this pull request Apr 22, 2026
…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]>
Lucas61000 pushed a commit to Lucas61000/ray that referenced this pull request May 15, 2026
…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]>
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
…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

community-contribution Contributed by the community 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