Repository navigation
[Data] Fix excessive scan threads in V2 file reads - #68344
goutamvenkat-anyscale merged 4 commits into
Conversation
Allow a DataContext setting to limit the Python fragment scan workers per Parquet V2 read task. Store the cap on the scanner so a retried task uses the same worker count and batch order. Signed-off-by: zzchun <[email protected]>
02a3fef to
a87e1fb
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces the parquet_max_fragment_workers configuration to limit the number of concurrent fragment scan workers per Parquet V2 read task. This limit is exposed via DataContext and the RAY_DATA_PARQUET_MAX_FRAGMENT_WORKERS environment variable, with backward compatibility handled for older serialized datasets. The review feedback suggests strengthening the validation of max_fragment_workers in FileReader to strictly require a positive integer, preventing potential type mismatches with floats or booleans.
Signed-off-by: will <[email protected]>
Signed-off-by: will <[email protected]>
Signed-off-by: will <[email protected]>
|
Hi @goutamvenkat-anyscale, would you have a chance to take a look at this PR when you have a moment? Given your work on Parquet read concurrency in #65806, I’d really appreciate your thoughts on the default cap of 64 fragment workers per V2 read task. If it looks good to you, I’d appreciate your help getting it merged. Thanks for your time! |
The shared DataSource V2
FileReadernow limits each parallel read task to 64 Python fragment workers by default. Parquet can pack many small files into one task by byte size, so a 128-fragment task previously started 128 scan threads.flowchart LR subgraph Before["Before · IO / FileReader"] B["128 fragments in one task"] --> BW["128 scan workers"] end subgraph After["After · IO / FileReader"] A["128 fragments in one task"] --> AW["64 scan workers by default"] end classDef removed fill:#ffcdd2,color:#222 classDef added fill:#c8e6c9,color:#222 class BW removed class AW addedTo override the default, set
RAY_DATA_FILE_READER_MAX_FRAGMENT_WORKERSin the worker environment before importing Ray Data. The reader usesmin(fragment_count, configured_limit). A limit of 1 or less selects the sequential path, as doesexecution_options.preserve_order=True. Use the same setting on all workers so retries can reproduce the batch sequence.Fixes #68342. This is the only open PR I found addressing that issue. #65806 removed an earlier four-thread limit to improve remote I/O overlap.
Subsystems · IO (shared V2 file reader) and API (Parquet and ORC read documentation).
Testing
python -m pytest -q python/ray/data/tests/test_context.py \ python/ray/data/tests/unit/datasource_v2/{test_parquet_datasource_v2,test_hive_direct,test_parquet_size_statistics,test_parquet_row_group_coalescing,test_parquet_decoded_size,test_orc_file_reader,test_orc_datasource_v2}.pyAll 704 tests passed locally at
f0249d41c5using the branch’s Ray Data code and Ray Core nightlyeb50407602. All applicable pre-commit hooks passed.The regression test reads three Parquet files in each case. A cap of 2 uses two fragment workers, a cap of 4 uses three workers, and a cap of 0 reads sequentially. Each case verifies that all three row IDs appear exactly once.