Skip to content

benchmarks: run each query in a fresh process pair in interleave.py - #27978

Draft
adriangb wants to merge 1 commit into
apache:mainfrom
adriangb:interleave-fresh-pair-per-query
Draft

adriangb wants to merge 1 commit into
apache:mainfrom
adriangb:interleave-fresh-pair-per-query

Conversation

@adriangb

@adriangb adriangb commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

With one long-lived baseline/branch process pair, a query's timing depends on the queries that ran before it. A 3-VM matrix (43 ClickBench queries, interleaved ABBA runs, 30 runs per VM) compared the forward query order against the reversed order. It counted query-sides (of 86) whose median moved by more than 3%:

Process model mimalloc purge disabled default mimalloc
Shared pair for all queries 7 to 10 28 to 41
Fresh pair per query 0 to 2 3 to 7

Wall time was the same (about 900 s per full run), because the time budget is per query.

What changes are included in this PR?

benchmarks/interleave.py:

  • A new required --queries argument (such as 0-42 or 1,3,5-7).
  • For each query, the script starts a fresh pair with --query <id> and a temporary -o file per side.
  • At the end, it merges the per-query files into the -o file of each command (context from the first run, queries concatenated), so compare.py is unchanged.
  • ABBA order, the even-pairs rule, failure handling and the stopping rules are unchanged.

No script in this repo calls interleave.py yet, so no caller changes.

What is the testing strategy for this PR?

Manual smoke run on one ClickBench partition (hits_0.parquet), queries 0 and 1, --iterations 2 --max-time 3. Each query ran in its own pair, the merged files held both queries, and compare.py read them. A query id with no query file stops the run with the dfbench error.

Are there any user-facing changes?

interleave.py now needs --queries, and the commands must not pass --query.

🤖 Generated with Claude Code

@adriangb
adriangb force-pushed the interleave-fresh-pair-per-query branch from 02fe280 to c25fde2 Compare December 4, 2026 23:41
A long-lived baseline/branch process pair makes each query's timing
depend on the queries that ran before it (allocator state, heap
layout). On ClickBench, reversing the query order moved 28 to 41 of 86
query-sides by more than 3% with a shared pair, and 3 to 7 with a fresh
pair per query, at the same wall time.

interleave.py now takes `--queries` (such as `0-42`), starts a fresh
pair with `--query <id>` for each query, and merges the per-query
results into the `-o` file of each command, so compare.py is unchanged.
ABBA order, the even-pairs rule, failure handling and stopping rules
are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adriangb
adriangb force-pushed the interleave-fresh-pair-per-query branch from c25fde2 to 6256484 Compare December 4, 2026 23:47
adriangb added a commit to adriangb/datafusion-benchmarking that referenced this pull request Dec 5, 2026
The interleave.py on DataFusion main has no --queries flag. It runs every
query of a benchmark in one baseline and one branch process, and still
alternates iterations within each query. Passing --queries made the
script exit with an argparse error, so interleave mode only worked with
apache/datafusion#27978.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
adriangb added a commit to adriangb/datafusion-benchmarking that referenced this pull request Dec 5, 2026
* runner: extract one side of a bench.sh run into run_shell_bench

The base and branch runs of a bench.sh benchmark repeated the same spill,
pool-peak and stats steps. An interleaved mode needs to choose per benchmark
between this pair of runs and a single interleaved run, so the pair moves
into a helper first. This is a refactor and does not change behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* runner: add an opt-in interleaved mode through interleave.py

Sequential runs measure all base iterations, then all branch iterations,
so a slow period on the node lands on one side only. DataFusion's
benchmarks/interleave.py (apache/datafusion#27978) alternates single
iterations ABBA between a fresh base and branch dfbench per query.

A trigger selects it with BENCH_MODE: interleave in the shared env block,
with INTERLEAVE_ITERATIONS and INTERLEAVE_MAX_TIME as knobs. The runner
interleaves the TPC-H and ClickBench suites when the branch has
interleave.py and both dfbench builds accept --lockstep-in. Every other
benchmark runs sequentially. The result comment states the mode and the
reason for each sequential fallback. Each side still writes its results
JSON, so bench.sh compare is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* runner: drive interleave.py without --queries

The interleave.py on DataFusion main has no --queries flag. It runs every
query of a benchmark in one baseline and one branch process, and still
alternates iterations within each query. Passing --queries made the
script exit with an argparse error, so interleave mode only worked with
apache/datafusion#27978.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant