Repository navigation
perf: read shuffle blocks in 64 KiB pieces instead of through Channels.newChannel
#6805
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
Merged
andygrove
merged 5 commits into
apache:main
from
comphead:perf-shuffle-reader-chunked-reads
Oct 11, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9ad49c4
perf: read shuffle blocks in 64 KiB pieces instead of through `Channe…
comphead 4edc57a
Make the shuffle read buffer size configurable and share the read loop
comphead cf50ca0
Pass the read buffer size default as a Long
comphead 5c025a8
feedback
comphead 1346697
Move the local benchmarks out of this PR
comphead File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropping
Channels.newChannelalso drops the only thing that stopped a killed task on the direct read path. The JDK channel checks the thread's interrupt status on every read and throwsClosedByInterruptException, and native callshasNext()on the task thread.readAsRawStream()inCometBlockStoreShuffleReaderreturns a bareSequenceInputStream, so this path has noInterruptibleIterator. With this change a killed task keeps reading until the shuffle block it is on runs out.I measured it locally with a 20M row shuffle into a single block, read by a native project, and killed the reduce task 1 s into its 5.6 s read. With an interrupting kill, which is what speculation and Spark Connect and Thrift server cancellation use, the task stopped 11 ms after the kill on main and kept going for 4.6 s on this branch. The skewed partition this PR is aimed at is also the task most likely to get a speculative copy, and the losing copy now holds its core and memory until it finishes reading its current block.
Could
readAsRawStream()wrap the stream so that each read callscontext.killTaskIfInterrupted(), the way the Celeborn reader's stream already does? I tried that on top of this branch. Kills with and without an interrupt both stopped within about 10 ms, and a task that isn't killed took the same time. A test that marks the task context interrupted and checks that the next read throwsTaskKilledExceptionwould keep this from regressing again.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in
5c025a8acbas you suggested. I measured it locally with one 1.4 GiB shuffle block read by a native project and cancelled 1 s into the read. The direct-read task now stops 1 ms after the cancel, with or without an interrupt. Before the fix it kept reading for about 3.4 s either way, and onmainit did so for kills without an interrupt. The table againstmainis in the description.