Reduce chunk batch iterator BatchSize - #7823
Merged
Merged
Conversation
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?
Contributor
Author
There was a problem hiding this comment.
Thanks. I have updated the comment accordingly.
Signed-off-by: Paurush Garg <paurushg@amazon.com>
PaurushGarg
force-pushed
the
reduce-batch-size
branch
from
September 11, 2026 04:52
61904bf to
f440512
Compare
harry671003
approved these changes
Sep 11, 2026
danielblando
approved these changes
Sep 11, 2026
Contributor
|
Would it make queries slower for promql engine? |
CharlieTLe
added a commit
to CharlieTLe/cortex
that referenced
this pull request
Sep 11, 2026
Get the unreleased section into the shape RELEASE.md asks for before the release-1.22 cut, so operators reading the notes see the changes that affect them: - Delete the stale duplicate of cortexproject#7375, which already shipped in 1.21.0 as cortexproject#7370. - Re-sort into CHANGE -> FEATURE -> ENHANCEMENT -> BUGFIX. - Correct the gRPC entry: the bump landed at v1.82.1, not v1.79.3. - Fold follow-up PRs into the entry they belong to. - Add three missing user-facing entries: cortexproject#7513, cortexproject#7514 and cortexproject#7559. - Reclassify as CHANGE the entries that break existing configs or log consumers: the sign-key validation (cortexproject#7587), the Alertmanager per-tenant *_file rejections (cortexproject#7767, cortexproject#7768, now one entry) and the time_taken -> time_taken_ms rename (cortexproject#7649). - Note the operator impact of the distroless base image (cortexproject#7637) and of the 500 -> 499 reclassification (cortexproject#7717). Rebased onto master, which added eight entries after this was first written. They are curated the same way: - Sorted into their categories: the deprecated flag removal (cortexproject#7790) and the max-exemplars deprecation (cortexproject#7793) under CHANGE, the X-Grafana-User query log (cortexproject#7799) under ENHANCEMENT, the YAML zero-value validation (cortexproject#7700) and the ReadPartitionedGroupInfo error handling (cortexproject#7766) under BUGFIX. - Folded the Go toolchain bump (cortexproject#7807, cortexproject#7814) into the existing build image entry, which now reads 1.27.0 rather than carrying a second entry for it. - Folded cortexproject#7745 into cortexproject#7698: both are the same wipe-on-transient-DNS-failure bug, cortexproject#7698 on the A record path and cortexproject#7745 on the SRV path. - Folded cortexproject#7743 into cortexproject#7640: both are panics in the active request tracker's truncation of match[]/query values. Rebased again onto master, which added eight more entries. Same treatment: - Sorted into their categories: the evaluation-delay-duration removal (cortexproject#7792) and the fifocache/ingester-metadata-streaming removals (cortexproject#7791) under CHANGE, the parquet max-block-label-names limit (cortexproject#7625), the non-pointer HistogramBucket slice (cortexproject#7809) and the merge iterator BatchSize (cortexproject#7823) under ENHANCEMENT, and the CSV-list empty-string fix (cortexproject#7714) under BUGFIX. - Folded the Thanos/promql-engine refresh (cortexproject#7788) into the existing upgrade entry, which already carries cortexproject#7691, cortexproject#7505 and cortexproject#7740. Signed-off-by: Charlie Le <charlie_le@apple.com>
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