Skip to content

DRAFT Bench 26264 - #27154

Draft
kosiew wants to merge 4 commits into
apache:mainfrom
kosiew:bench-26264
Draft

kosiew wants to merge 4 commits into
apache:mainfrom
kosiew:bench-26264

Conversation

@kosiew

@kosiew kosiew commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Bench 26264

kosiew and others added 4 commits November 6, 2026 13:45
- Four lone-sort configurations; reports spill counts, rows, bytes.
- Validates sorted output and reservation cleanup.
- Debug/CI-profile smoke, Clippy, formatting pass.
- Full suites timed out. Four-partition case excluded: memory exhaustion.
The final merge of a spilled sort seated every run the memory pool
would admit, and held those buffers until its output was consumed.
Partitions that finished their input early could take the whole pool
this way, and a partition still sorting then failed with
ResourcesExhausted (apache#25804, finding 9).

Seat runs beyond the minimum two only while the pool can admit what
the merge takes beyond its own workspace plus as much again, and
return the extra before merging, as apache#25383 does for aggregate replay.
The minimum merge is admitted as before, so a sort under tight memory
keeps its batch sizes and does not re-spill runs to leave headroom.
Check at the builder that runs beyond the minimum two are seated only
with equal headroom, and that a headroom request beyond usize::MAX
stops seating runs instead of failing the merge.
The fan-in headroom made a lone sort partition that has the pool to
itself rewrite runs in an extra merge pass, for no one: with 60 x 8192
rows of Int64 plus a 120-byte string, 1 MB sort_spill_reservation_bytes
and a 16 MB GreedyMemoryPool, it wrote 1,589,248 rows to spill instead
of 983,040.

Keep the headroom only while the sort has other partitions sharing the
pool, or another consumer holds memory in it. Sibling partitions count
even when they hold nothing at the moment the merge seats its runs.
The operator consuming the output of a lone partition is not counted:
it reserves nothing before its first batch, and keeping headroom for it
would cost the extra pass whether or not it ever needs the memory.

With one partition, the case above writes the same rows as without
headroom in all four configurations measured. With four partitions in
a 32 MB pool and 1 MB reservations, the sort fails with "Not enough
memory to continue external sort" without headroom and succeeds with
it.

Also cover the minimum two runs under a budget below their headroom,
and seating against a retained merge workspace on both sides of
2 * (T - W).
@github-actions github-actions Bot added the physical-plan Changes to the physical-plan crate label Nov 6, 2026
@kosiew

kosiew commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

run benchmark sort_spill

baseline:
  ref: 6194e50c12

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c6677987080-4560-z8bgk 6.12.105+ #1 SMP Sat Sep 19 07:55:25 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected

Comparing bench-26264 (217bd1f) to 6194e50 diff

Run configuration
run benchmark sort_spill
baseline:
  ref: "6194e50c12"

Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

Comparing bench-26264 (217bd1f) to 6194e50 diff

Run configuration
run benchmark sort_spill
baseline:
  ref: "6194e50c12"
CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected
Details

group                               HEAD                                   bench-26264
-----                               ----                                   -----------
sort_spill/mb/workspace10_pool24    1.00    190.8±1.45ms        ? ?/sec    1.01    193.6±1.22ms        ? ?/sec
sort_spill/mb/workspace10_pool32    1.00    135.8±1.19ms        ? ?/sec    1.01    136.9±1.03ms        ? ?/sec
sort_spill/mb/workspace1_pool16     1.01    231.4±2.61ms        ? ?/sec    1.00    228.6±3.97ms        ? ?/sec
sort_spill/mb/workspace1_pool32     1.01    136.7±1.03ms        ? ?/sec    1.00    136.0±0.35ms        ? ?/sec

Resource Usage

sort_spill — base (merge-base)

Metric Value
Wall time 320.1s
Peak memory 117.2 MiB
Avg memory 18.2 MiB
CPU user 31.5s
CPU sys 32.1s
Peak spill 0 B

sort_spill — branch

Metric Value
Wall time 315.1s
Peak memory 117.5 MiB
Avg memory 18.3 MiB
CPU user 33.2s
CPU sys 32.6s
Peak spill 0 B

File an issue against this benchmark runner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-plan Changes to the physical-plan crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants