fix(scanner): honor batch_readahead to bound v2 scan decode concurrency#7632
Open
zhangyue19921010 wants to merge 1 commit into
Open
fix(scanner): honor batch_readahead to bound v2 scan decode concurrency#7632zhangyue19921010 wants to merge 1 commit into
zhangyue19921010 wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Background & Motivation
Under concurrent-scan workloads like Spark, a single large worker (Executor) typically runs many Tasks in parallel (in Lance's read path, 1 Task = 1 fragment = 1 scan). The problem: each Task independently sizes its own scan concurrency from the core count of the current Executor / host.
Concretely in Lance, the decode concurrency of the v2 read path
FilteredReadExec(plan nameLanceRead) — thetry_buffered(num_threads)— is unconditionally set toget_num_compute_intensive_cpus()=num_cpus − 2.Why It Was Deprecated, and the Gap It Left Behind
Scanner.batch_readaheadis markedIgnored in v2 and newer format— a deliberate decision, not an oversight. In v1 it controlled two things: prefetch depth and decode concurrency. v2 replaced prefetch with a byte-budget model (io_buffer_size+fragment_readahead), so its prefetch role became meaningless and was rightly dropped.The gap: v2 split the decode-concurrency role into
FilteredReadExec's threading mode (try_buffered(num_threads)), hard-coded toget_num_compute_intensive_cpus(). The only override today is the process-wideLANCE_CPU_THREADSenv var — far too coarse, since it governs every compute-intensive path at once (vector/KNN search, index building,take, update/merge-insert, …), not just scan decode concurrency. With no per-scan knob, there's no way to rein in the over-parallelization above.What This Change Does & Its Impact
Have
new_filtered_readpassScanner.batch_readaheadthrough asFilteredReadThreadingMode::OnePartitionMultipleThreads(batch_readahead), reattachingbatch_readaheadto the decode-concurrency dimension that v2 had left without a knob.