Skip to content

Reduce chunk batch iterator BatchSize - #7823

Merged
danielblando merged 1 commit into
cortexproject:masterfrom
PaurushGarg:reduce-batch-size
Sep 11, 2026
Merged

Reduce chunk batch iterator BatchSize#7823
danielblando merged 1 commit into
cortexproject:masterfrom
PaurushGarg:reduce-batch-size

Conversation

@PaurushGarg

@PaurushGarg PaurushGarg commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

What this PR does:
Each newMergeIterator allocates batches and batchesBuf slices sized by the number of chunk partitions (typically 3 with replication factor 3). With BatchSize=12, each Batch struct is 384 bytes, giving a per-iterator cost of ~2,560 bytes. With BatchSize=8, each Batch struct 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

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]
  • docs/configuration/v1-guarantees.md updated if this PR introduces experimental flags

@PaurushGarg PaurushGarg changed the title Reduce chunk batch iterator BatchSize from 12 to 8 Reduce chunk batch iterator BatchSize Sep 2, 2026
@PaurushGarg

PaurushGarg commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author
(26-08-27 22:37:18) <0> [~/workplace/cortex]  
dev-dsk-paurushg-2a-87a5ee42 % ~/go/bin/benchstat bench_12.txt bench_8.txt                                      
goos: linux
goarch: amd64
pkg: github.com/cortexproject/cortex/pkg/querier/batch
cpu: AMD EPYC 7R13 Processor
                                                                                                                                            │ bench_12.txt │            bench_8.txt             │
                                                                                                                                            │    sec/op    │   sec/op     vs base               │
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusXorChunk-32               4.104m ± 1%   4.141m ± 1%  +0.90% (p=0.002 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusXorChunk-32               11.94m ± 1%   12.13m ± 1%  +1.57% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusXorChunk-32                409.4µ ± 0%   412.4µ ± 0%  +0.73% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusXorChunk-32                1.198m ± 0%   1.208m ± 0%  +0.90% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusXorChunk-32                  5.071µ ± 3%   4.952µ ± 3%  -2.34% (p=0.005 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusXorChunk-32                  14.19µ ± 0%   14.03µ ± 0%  -1.12% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusHistogramChunk-32         29.95m ± 0%   30.51m ± 0%  +1.89% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusHistogramChunk-32         82.60m ± 0%   83.91m ± 0%  +1.59% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusHistogramChunk-32          3.107m ± 3%   3.244m ± 3%  +4.41% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusHistogramChunk-32          9.425m ± 2%   9.539m ± 1%  +1.22% (p=0.015 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusHistogramChunk-32            35.85µ ± 1%   33.76µ ± 4%  -5.81% (p=0.002 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusHistogramChunk-32            100.5µ ± 3%   103.6µ ± 6%       ~ (p=0.353 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusFloatHistogramChunk-32    29.67m ± 0%   30.14m ± 0%  +1.60% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusFloatHistogramChunk-32    82.20m ± 1%   83.77m ± 0%  +1.92% (p=0.001 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusFloatHistogramChunk-32     3.461m ± 2%   3.512m ± 0%       ~ (p=0.481 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusFloatHistogramChunk-32     9.712m ± 0%   9.818m ± 0%  +1.09% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusFloatHistogramChunk-32       37.59µ ± 5%   38.35µ ± 5%       ~ (p=0.481 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusFloatHistogramChunk-32       108.6µ ± 5%   113.5µ ± 4%  +4.56% (p=0.004 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_15s-32                                                                                 14.42m ± 1%   14.64m ± 0%  +1.54% (p=0.001 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_30s-32                                                                                 13.95m ± 0%   14.82m ± 4%  +6.21% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_60s-32                                                                                 13.81m ± 0%   14.12m ± 6%  +2.25% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_300s-32                                                                                15.58m ± 0%   15.20m ± 3%  -2.44% (p=0.035 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_900s-32                                                                                14.40m ± 1%   13.70m ± 4%  -4.82% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_1500s-32                                                                               12.19m ± 0%   12.28m ± 4%       ~ (p=0.393 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_3000s-32                                                                               5.713m ± 0%   5.702m ± 3%       ~ (p=0.393 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_6000s-32                                                                               2.006m ± 0%   1.946m ± 0%  -2.96% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_5s-32                                                                                  14.50m ± 0%   15.46m ± 6%  +6.62% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_10s-32                                                                                 14.02m ± 1%   14.25m ± 7%  +1.62% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_20s-32                                                                                 13.85m ± 0%   14.10m ± 4%  +1.83% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_100s-32                                                                                15.60m ± 0%   15.17m ± 0%  -2.72% (p=0.002 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_300s-32                                                                                14.41m ± 1%   13.17m ± 1%  -8.58% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_500s-32                                                                                12.28m ± 0%   11.81m ± 1%  -3.86% (p=0.002 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_1000s-32                                                                               5.711m ± 0%   5.561m ± 3%  -2.63% (p=0.023 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_2000s-32                                                                               2.010m ± 0%   1.950m ± 1%  -3.01% (p=0.000 n=10)
geomean                                                                                                                                        3.400m        3.407m       +0.22%

                                                                                                                                            │ bench_12.txt │             bench_8.txt              │
                                                                                                                                            │     B/op     │     B/op      vs base                │
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusXorChunk-32              111.6Ki ± 0%   111.3Ki ± 0%   -0.22% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusXorChunk-32              398.0Ki ± 0%   397.5Ki ± 0%   -0.13% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusXorChunk-32               12.59Ki ± 0%   12.34Ki ± 0%   -1.99% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusXorChunk-32               43.81Ki ± 0%   43.31Ki ± 0%   -1.14% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusXorChunk-32                  1232.0 ± 0%     976.0 ± 0%  -20.78% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusXorChunk-32                 2.820Ki ± 0%   2.320Ki ± 0%  -17.73% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusHistogramChunk-32        24.52Mi ± 0%   24.52Mi ± 0%   -0.00% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusHistogramChunk-32        73.63Mi ± 0%   73.63Mi ± 0%   -0.00% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusHistogramChunk-32         2.454Mi ± 0%   2.454Mi ± 0%   -0.01% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusHistogramChunk-32         7.368Mi ± 0%   7.368Mi ± 0%   -0.01% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusHistogramChunk-32           26.59Ki ± 0%   26.34Ki ± 0%   -0.94% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusHistogramChunk-32           78.99Ki ± 0%   78.49Ki ± 0%   -0.63% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusFloatHistogramChunk-32   24.52Mi ± 0%   24.52Mi ± 0%   -0.00% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusFloatHistogramChunk-32   73.63Mi ± 0%   73.63Mi ± 0%   -0.00% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusFloatHistogramChunk-32    2.454Mi ± 0%   2.454Mi ± 0%   -0.01% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusFloatHistogramChunk-32    7.368Mi ± 0%   7.367Mi ± 0%   -0.01% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusFloatHistogramChunk-32      26.50Ki ± 0%   26.25Ki ± 0%   -0.94% (p=0.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusFloatHistogramChunk-32      78.71Ki ± 0%   78.21Ki ± 0%   -0.64% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_15s-32                                                                                398.0Ki ± 0%   397.5Ki ± 0%   -0.13% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_30s-32                                                                                398.0Ki ± 0%   397.5Ki ± 0%   -0.13% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_60s-32                                                                                398.0Ki ± 0%   397.5Ki ± 0%   -0.13% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_300s-32                                                                               398.0Ki ± 0%   397.5Ki ± 0%   -0.13% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_900s-32                                                                               398.0Ki ± 0%   397.5Ki ± 0%   -0.13% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_1500s-32                                                                              398.0Ki ± 0%   397.5Ki ± 0%   -0.13% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_3000s-32                                                                              397.9Ki ± 0%   397.4Ki ± 0%   -0.13% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_6000s-32                                                                              397.9Ki ± 0%   397.4Ki ± 0%   -0.13% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_5s-32                                                                                 398.0Ki ± 0%   397.5Ki ± 0%   -0.13% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_10s-32                                                                                398.0Ki ± 0%   397.5Ki ± 0%   -0.13% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_20s-32                                                                                398.0Ki ± 0%   397.5Ki ± 0%   -0.13% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_100s-32                                                                               398.0Ki ± 0%   397.5Ki ± 0%   -0.13% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_300s-32                                                                               398.0Ki ± 0%   397.5Ki ± 0%   -0.13% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_500s-32                                                                               398.0Ki ± 0%   397.5Ki ± 0%   -0.13% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_1000s-32                                                                              397.9Ki ± 0%   397.4Ki ± 0%   -0.13% (p=0.000 n=10)
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_2000s-32                                                                              397.9Ki ± 0%   397.4Ki ± 0%   -0.13% (p=0.000 n=10)
geomean                                                                                                                                       422.2Ki        415.9Ki        -1.51%

                                                                                                                                            │ bench_12.txt │             bench_8.txt              │
                                                                                                                                            │  allocs/op   │  allocs/op   vs base                 │
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusXorChunk-32               2.008k ± 0%   2.008k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusXorChunk-32               6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusXorChunk-32                 208.0 ± 0%    208.0 ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusXorChunk-32                 617.0 ± 0%    617.0 ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusXorChunk-32                   10.00 ± 0%    10.00 ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusXorChunk-32                   23.00 ± 0%    23.00 ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusHistogramChunk-32         502.0k ± 0%   502.0k ± 0%       ~ (p=0.303 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusHistogramChunk-32         1.506M ± 0%   1.506M ± 0%       ~ (p=0.470 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusHistogramChunk-32          50.21k ± 0%   50.21k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusHistogramChunk-32          150.6k ± 0%   150.6k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusHistogramChunk-32             514.0 ± 0%    514.0 ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusHistogramChunk-32            1.535k ± 0%   1.535k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusFloatHistogramChunk-32    502.0k ± 0%   502.0k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_CreateAndIterate/chunks:_1000_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusFloatHistogramChunk-32    1.506M ± 0%   1.506M ± 0%       ~ (p=1.000 n=10)
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusFloatHistogramChunk-32     50.21k ± 0%   50.21k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_CreateAndIterate/chunks:_100_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusFloatHistogramChunk-32     150.6k ± 0%   150.6k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_1_encoding:_PrometheusFloatHistogramChunk-32        514.0 ± 0%    514.0 ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_CreateAndIterate/chunks:_1_samples_per_chunk:_100_duplication_factor:_3_encoding:_PrometheusFloatHistogramChunk-32       1.535k ± 0%   1.535k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_15s-32                                                                                 6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_30s-32                                                                                 6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_60s-32                                                                                 6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_300s-32                                                                                6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_900s-32                                                                                6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_1500s-32                                                                               6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_3000s-32                                                                               6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_Seek/scrapeInterval_30s_seekStep:_6000s-32                                                                               6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_5s-32                                                                                  6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_10s-32                                                                                 6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_20s-32                                                                                 6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_100s-32                                                                                6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_300s-32                                                                                6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_500s-32                                                                                6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_1000s-32                                                                               6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
NewChunkMergeIterator_Seek/scrapeInterval_10s_seekStep:_2000s-32                                                                               6.017k ± 0%   6.017k ± 0%       ~ (p=1.000 n=10) ¹
geomean                                                                                                                                        6.812k        6.812k       +0.00%
¹ all samples are equal

(26-08-27 22:37:34) <0> [~/workplace/cortex]  
dev-dsk-paurushg-2a-87a5ee42 % 

@PaurushGarg
PaurushGarg marked this pull request as ready for review September 2, 2026 22:48
@PaurushGarg
PaurushGarg requested a review from a team as a code owner September 2, 2026 22:48
Comment thread pkg/chunk/iterator.go
// BatchSize is samples per batch; this was choose by benchmarking all sizes from
// 1 to 128.
const BatchSize = 12
const BatchSize = 8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update the comment above with the reasoning?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I have updated the comment accordingly.

Signed-off-by: Paurush Garg <paurushg@amazon.com>
@danielblando
danielblando merged commit 4061a3d into cortexproject:master Sep 11, 2026
40 checks passed
@yeya24

yeya24 commented Sep 11, 2026

Copy link
Copy Markdown
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants