Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data] Enable per-op resource reservation #43171

Merged
merged 83 commits into from
Feb 27, 2024

Conversation

raulchen
Copy link
Contributor

@raulchen raulchen commented Feb 14, 2024

Why are these changes needed?

This PR enables per-op resource reservation by default. See docstring of ReservationOpResourceAllocator for the concrete protocol.
Besides, this PR also:

  • Increases the default object store memory limit from 25% to 50%, because now we have more precise control of memory.
  • Renames OpResourceLimiter to OpResourceAllocator, and adds 2 new APIs.
  • Implements a bunch of perf optimizations for different scenarios in ReservationOpResourceAllocator.
  • Removes StreamingOutputBackpressurePolicy. as this feature is now implemented as ReservationOpResourceAllocator.max_task_output_bytes_to_read.
  • Removes use_runtime_metrics_scheduling.
  • Fixes a bug and adds util functions in ExecutionResources.
  • Adds detailed resource usage in progress bars.

Related issue number

Closes #42217
#40754

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>

fix usage_str

Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>
Copy link
Member

@bveeramani bveeramani left a comment

Choose a reason for hiding this comment

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

Discussed feedback offline. Otherwise LGTM.

Comment on lines 395 to 396
ExecutionResources(cpu=1) as its incremental usage.
Args:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ExecutionResources(cpu=1) as its incremental usage.
Args:
ExecutionResources(cpu=1) as its incremental usage.
Args:

Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Hao Chen <[email protected]>
@raulchen raulchen merged commit d6380d4 into ray-project:master Feb 27, 2024
8 of 9 checks passed
@raulchen raulchen deleted the enable-memory-reservation branch February 27, 2024 21:05
@can-anyscale
Copy link
Collaborator

This broke #43490 and #43493, I'm putting up a revert to confirm

@can-anyscale
Copy link
Collaborator

as well as this test

Screenshot 2024-02-28 at 10 12 16 AM

can-anyscale pushed a commit that referenced this pull request Feb 29, 2024
Fix bugs in ReservationOpResourceAllocator (introduced by #43171)
* We treat a map op and its following non-map ops as the same group. `update_resources` already handles this properly . But `_should_unblock_streaming_output_backpressure` and ` _op_outputs_reserved_remaining` didn't consider this.
* Since we don't reserve any resources for `limit` and `streaming_split`, should set `num_cpus=0` for their tasks. 
* `_reserved_for_op_outputs` currently also includes op's internal output buffers. This is incorrect, because when `preserve_order=True`, task outputs will accumulate in op's internal output buffer, and use all the memory budget from `_reserved_for_op_outputs`. Then we still don't have memory budget to pull the blocks from the internal output buffer. Excluding the internal output buffer from `_reserved_for_op_outputs` fixes this issue.

Also deflake `test_backpressure_from_output` and `test_e2e_autoscaling_up`, as they depend on physical memory size of the node. 

Signed-off-by: Hao Chen <[email protected]>
raulchen added a commit that referenced this pull request Feb 29, 2024
there is a perf regression for those 2 small-sized test cases in ray-data-resnet50-ingest-file-size-benchmark, due to the new backpressure change (#43171).
Update some configs to fix the perf issue.

Signed-off-by: Hao Chen <[email protected]>
raulchen added a commit that referenced this pull request Mar 4, 2024
…on not enabled (#43686)

#43171 increased the default memory limit fraction to 50%. because with memory reservation, we have more precise control over the memory. 
This PR set the default back to 25%, when memory reservation is not enabled, to prevent regression. 

Signed-off-by: Hao Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data] Improve StreamingOutputBackpressurePolicy
4 participants