Reduce chunk batch iterator BatchSize - #7823
Open
PaurushGarg wants to merge 1 commit into
Open
Conversation
Signed-off-by: Paurush Garg <paurushg@amazon.com>
PaurushGarg
force-pushed
the
reduce-batch-size
branch
from
September 2, 2026 22:18
3037e34 to
61904bf
Compare
Contributor
Author
|
harry671003
reviewed
Sep 2, 2026
| // BatchSize is samples per batch; this was choose by benchmarking all sizes from | ||
| // 1 to 128. | ||
| const BatchSize = 12 | ||
| const BatchSize = 8 |
Contributor
There was a problem hiding this comment.
Could you update the comment above with the reasoning?
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.
What this PR does:
Each
newMergeIteratorallocatesbatchesandbatchesBufslices sized by the number of chunk partitions (typically 3 with replication factor 3). WithBatchSize=12, eachBatchstruct is 384 bytes, giving a per-iterator cost of ~2,560 bytes. WithBatchSize=8, eachBatchstruct is 256 bytes, reducing per-iterator cost to ~1,792 bytes (~30% reduction).This matters for query engines that allocate all iterators upfront - one per series - and hold them alive for the duration of the query. At high cardinality (millions of series), the cumulative merge iterator allocation becomes the dominant heap consumer. Reducing the per-iterator footprint directly reduces heap pressure under concurrent high-cardinality queries.
Benchmark
#7823 (comment)
Seeks (15s - 60s): ~1.5-2% slower
Seeks (300s - 6000s): 3-9% faster
geomean: −1.5%
Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]docs/configuration/v1-guarantees.mdupdated if this PR introduces experimental flags