Skip to content

[Data] DownstreamCapacity: don't count blocks the consumer already holds as output pressure - #66095

Closed
sampan-s-nayak wants to merge 1 commit into
ray-project:masterfrom
sampan-s-nayak:sampan/data-downstream-capacity-terminal-queues
Closed

sampan-s-nayak wants to merge 1 commit into
ray-project:masterfrom
sampan-s-nayak:sampan/data-downstream-capacity-terminal-queues

Conversation

@sampan-s-nayak

@sampan-s-nayak sampan-s-nayak commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

overview

lightgbm_train_batch_inference_benchmark_100G fails in release test with RuntimeError: Training is taking ... longer than expected (600 seconds). The training dataset read that normally takes ~40s takes 400-560s.

Root cause: since #64456 the DownstreamCapacityBackpressurePolicy measures an operator's output pressure with the block ref counter. When the output goes to an iterator or streaming_split, that number includes every block the consumer has already taken and still holds. The LightGBM/XGBoost train loops call materialize() on their shard, so they hold every block until training ends. The read op's "pending output" then looks like the whole dataset (51 GiB) versus ~1 GiB of consumer prefetch, the ratio never drops, and ReadFiles is pinned to a single task by the liveness fallback (Tasks: 1 [backpressured:tasks(DownstreamCapacity)]).

Fix

For an operator with no eligible downstream operator, compute output pressure from what is actually queued (its output queues, the pass-through operators' queues such as OutputSplitter, plus the bytes the consumer reports holding) instead of the ref count. Operator-to-operator edges keep the current ref-count measure, where it is accurate because downstream tasks release blocks when they finish.

@sampan-s-nayak
sampan-s-nayak requested a review from a team as a code owner September 11, 2026 09:13

@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 refactors the downstream capacity backpressure policy to avoid incorrect backpressuring when downstream consumers retain output blocks (e.g., during training jobs with materialize()). It introduces a new helper method _get_output_size_bytes that calculates the buffered bytes in queues instead of relying on the block reference counter when there are no eligible downstream operators. The feedback suggests simplifying the check for eligible downstream operators using a more idiomatic any() call, and adding defensive guards against potential AttributeError or KeyError when accessing operator metrics and topology.

…lds as output pressure

When a pipeline's output goes to an iterator or streaming_split, the ref-counted output usage includes every block the consumer has taken and kept (e.g. Train workers calling materialize()). That pinned ReadFiles to one task in lightgbm_train_batch_inference_benchmark_100G. Count queued bytes plus consumer-reported bytes for that case instead.

Signed-off-by: sampan <[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 release-test release test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant