Skip to content

[Data] Expose flag to run read tasks on isolated worker processes - #63490

Merged
bveeramani merged 9 commits into
masterfrom
balaji/isolate-read-workers
Jun 3, 2026
Merged

bveeramani merged 9 commits into
masterfrom
balaji/isolate-read-workers

Conversation

@bveeramani

@bveeramani bveeramani commented May 19, 2026 •

Copy link
Copy Markdown
Member

Description

PyArrow allocates lots of memory during reads. When the read task worker gets reused by downstream operators, that allocation isn't cleaned up. This causes problems because even if a downstream task doesn't require much memory, its RSS can be many GBs and that causes unnecessary OOM kills.

To mitigate this issue, I'm adding an isolate_read_workers flag to DataContext. It sets an environment variable on the reads' runtime environments so that they get scheduled on different workers than the downstream operators.

I'm disabling this by default because the flag can cause performance regressions in some cases.

Additional information

Documentation out of scope for now -- will address in follow up.

Related issues

None.

When DataContext.isolate_read_workers is True (the default), read tasks
are submitted with a per-operator runtime_env so they get their own
worker process pool. This prevents large memory allocations by PyArrow
during reads from inflating the resident memory of workers that are
later reused by subsequent operators.

Signed-off-by: Balaji Veeramani <[email protected]>
@bveeramani
bveeramani requested a review from a team as a code owner May 19, 2026 05:49
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@bveeramani
bveeramani marked this pull request as draft May 19, 2026 05:55
isolate_workers is now a constructor parameter on TaskPoolMapOperator
(not the base MapOperator), since it only applies to task pools.
MapOperator.create() still accepts it and logs a debug message when
used with ActorPoolStrategy.

Signed-off-by: Balaji Veeramani <[email protected]>
When fusing map operators, the fused operator inherits
isolate_workers=True if either input operator had it set. Exposes
a read-only isolate_workers property on TaskPoolMapOperator.

Signed-off-by: Balaji Veeramani <[email protected]>
Signed-off-by: Balaji Veeramani <[email protected]>
Signed-off-by: Balaji Veeramani <[email protected]>
@bveeramani
bveeramani marked this pull request as ready for review May 27, 2026 18:27
@bveeramani bveeramani changed the title [Data] Isolate read workers into their own process pool [Data] Expose flag to run read tasks on separate worker processes May 27, 2026
@bveeramani bveeramani changed the title [Data] Expose flag to run read tasks on separate worker processes [Data] Expose flag to run read tasks on isolated worker processes May 27, 2026
@ray-gardener ray-gardener Bot added the data Ray Data-related issues label May 27, 2026
Comment thread python/ray/data/context.py Resolved

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8808911. Configure here.

@bveeramani
bveeramani enabled auto-merge (squash) June 3, 2026 04:30
@github-actions github-actions Bot added the go add ONLY when ready to merge, run all tests label Jun 3, 2026
Signed-off-by: Balaji Veeramani <[email protected]>
@github-actions
github-actions Bot disabled auto-merge June 3, 2026 04:37
Signed-off-by: Balaji Veeramani <[email protected]>
@bveeramani
bveeramani enabled auto-merge (squash) June 3, 2026 04:39
@bveeramani
bveeramani merged commit 6058f06 into master Jun 3, 2026
4 checks passed
@bveeramani
bveeramani deleted the balaji/isolate-read-workers branch June 3, 2026 05:33
bveeramani added a commit that referenced this pull request Jun 3, 2026
In #63490, I added a flag to
`DataContext` called `isolate_read_workers`.

In this PR, I'm adding documentation to `read_parquet` describing how to
use the flag.

---------

Signed-off-by: Balaji Veeramani <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
rueian pushed a commit to rueian/ray that referenced this pull request Jun 4, 2026
…y-project#63490)

## Description

PyArrow allocates lots of memory during reads. When the read task worker
gets reused by downstream operators, that allocation isn't cleaned up.
This causes problems because even if a downstream task doesn't require
much memory, it's RSS can be many GBs and that causes unnecessary OOM
kills.

To mitigate this issue, I'm adding an `isolate_read_workers` flag to
`DataContext`. It sets an environment variable on the reads' runtime
environments so that they get scheduled on different workers than the
downstream operators.

I'm disabling this by default because the flag can cause performance
regressions in some cases.

## Additional information

Documentation out of scope for now -- will address in follow up.

## Related issues

None.

---------

Signed-off-by: Balaji Veeramani <[email protected]>
rueian pushed a commit to rueian/ray that referenced this pull request Jun 4, 2026
…project#63816)

In ray-project#63490, I added a flag to
`DataContext` called `isolate_read_workers`.

In this PR, I'm adding documentation to `read_parquet` describing how to
use the flag.

---------

Signed-off-by: Balaji Veeramani <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
limarkdcunha pushed a commit to limarkdcunha/ray that referenced this pull request Jun 30, 2026
…y-project#63490)

## Description

PyArrow allocates lots of memory during reads. When the read task worker
gets reused by downstream operators, that allocation isn't cleaned up.
This causes problems because even if a downstream task doesn't require
much memory, it's RSS can be many GBs and that causes unnecessary OOM
kills.

To mitigate this issue, I'm adding an `isolate_read_workers` flag to
`DataContext`. It sets an environment variable on the reads' runtime
environments so that they get scheduled on different workers than the
downstream operators.

I'm disabling this by default because the flag can cause performance
regressions in some cases.

## Additional information

Documentation out of scope for now -- will address in follow up.

## Related issues

None.

---------

Signed-off-by: Balaji Veeramani <[email protected]>
limarkdcunha pushed a commit to limarkdcunha/ray that referenced this pull request Jun 30, 2026
…project#63816)

In ray-project#63490, I added a flag to
`DataContext` called `isolate_read_workers`.

In this PR, I'm adding documentation to `read_parquet` describing how to
use the flag.

---------

Signed-off-by: Balaji Veeramani <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
elliot-barn added a commit that referenced this pull request Aug 4, 2026
…V2 (#65191) (#65207)

Cherry-pick of #65191 to `releases/2.57.0`.

> **Note:** #65191 is still open on master at the time of this
cherry-pick (picked from its head commit e3413a2). If it changes
before merging to master, this PR should be updated to match.

## Original description

#63490 added a setting,
`isolate_read_workers`, to run reads on dedicated worker processes. The
intention was to mitigate memory bloat from PyArrow from affecting
downstream stages.

The PR only added a test with `Datasource` (V1), but not with
`DatasourceV2`. As a result, we've shipped a bug where the flag doesn't
work correctly with `DatasourceV2`.

This PR fixes the bug and also adds a regression test.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Balaji Veeramani <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
bveeramani added a commit that referenced this pull request Aug 4, 2026
#63490 added a setting,
`isolate_read_workers`, to run reads on dedicated worker processes. The
intention was to mitigate memory bloat from PyArrow from affecting
downstream stages.

The PR only added a test with `Datasource` (V1), but not with
`DatasourceV2`. As a result, we've shipped a bug where the flag doesn't
work correctly with `DatasourceV2`.

In this PR, I'm fixing the bug and also adding a regression test.

---------

Signed-off-by: Balaji Veeramani <[email protected]>
Artimislyy pushed a commit to Artimislyy/ray that referenced this pull request Aug 11, 2026
…65191)

ray-project#63490 added a setting,
`isolate_read_workers`, to run reads on dedicated worker processes. The
intention was to mitigate memory bloat from PyArrow from affecting
downstream stages.

The PR only added a test with `Datasource` (V1), but not with
`DatasourceV2`. As a result, we've shipped a bug where the flag doesn't
work correctly with `DatasourceV2`.

In this PR, I'm fixing the bug and also adding a regression test.

---------

Signed-off-by: Balaji Veeramani <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…y-project#63490)

## Description

PyArrow allocates lots of memory during reads. When the read task worker
gets reused by downstream operators, that allocation isn't cleaned up.
This causes problems because even if a downstream task doesn't require
much memory, it's RSS can be many GBs and that causes unnecessary OOM
kills.

To mitigate this issue, I'm adding an `isolate_read_workers` flag to
`DataContext`. It sets an environment variable on the reads' runtime
environments so that they get scheduled on different workers than the
downstream operators.

I'm disabling this by default because the flag can cause performance
regressions in some cases.

## Additional information

Documentation out of scope for now -- will address in follow up.

## Related issues

None.

---------

Signed-off-by: Balaji Veeramani <[email protected]>
Signed-off-by: 400Ping <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…project#63816)

In ray-project#63490, I added a flag to
`DataContext` called `isolate_read_workers`.

In this PR, I'm adding documentation to `read_parquet` describing how to
use the flag.

---------

Signed-off-by: Balaji Veeramani <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: 400Ping <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…65191)

ray-project#63490 added a setting,
`isolate_read_workers`, to run reads on dedicated worker processes. The
intention was to mitigate memory bloat from PyArrow from affecting
downstream stages.

The PR only added a test with `Datasource` (V1), but not with
`DatasourceV2`. As a result, we've shipped a bug where the flag doesn't
work correctly with `DatasourceV2`.

In this PR, I'm fixing the bug and also adding a regression test.

---------

Signed-off-by: Balaji Veeramani <[email protected]>
Signed-off-by: 400Ping <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…65191)

ray-project#63490 added a setting,
`isolate_read_workers`, to run reads on dedicated worker processes. The
intention was to mitigate memory bloat from PyArrow from affecting
downstream stages.

The PR only added a test with `Datasource` (V1), but not with
`DatasourceV2`. As a result, we've shipped a bug where the flag doesn't
work correctly with `DatasourceV2`.

In this PR, I'm fixing the bug and also adding a regression test.

---------

Signed-off-by: Balaji Veeramani <[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 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