Skip to content

bench: add a compressed high-partition writer case (#7080) - #7199

Open
HarshilMital wants to merge 2 commits into
apache:mainfrom
HarshilMital:bench/7080-writer-high-partition-compressed
Open

HarshilMital wants to merge 2 commits into
apache:mainfrom
HarshilMital:bench/7080-writer-high-partition-compressed

Conversation

@HarshilMital

Copy link
Copy Markdown

Which issue does this PR close?

Part of #7080.

Rationale for this change

The high-partition group only ran with CompressionCodec::None, but a wide shuffle runs with LZ4 by default. At high partition counts every block is tiny, so the per-block codec cost (a fresh LZ4 frame encoder, its header and end mark) is spread over very few rows and was never measured.

What changes are included in this PR?

Each partition count in shuffle_writer_high_partition (200, 2000 and 8000 hash partitions, end to end) now also runs with Lz4Frame, next to the existing None rows. The existing IDs are unchanged. sample_size(10), as the group already uses.

Results

Machine: 8 vCPU Arm Neoverse-V2 (aarch64), 31 GiB RAM, rustc 1.99.1
Commit: 174bbc6. Median with Criterion's 95% interval.

Reproduce from native/:

cargo bench -p datafusion-comet-shuffle --bench shuffle_writer -- 'shuffle_writer_high_partition' --save-baseline main
Partitions compression=None compression=Lz4Frame Lz4Frame vs None
200 14.24 ms (14.24 ms – 14.25 ms) 6.87 ms (6.85 ms – 6.88 ms) -52%
2000 21.03 ms (20.84 ms – 21.23 ms) 21.74 ms (21.69 ms – 21.80 ms) +3%
8000 44.02 ms (43.90 ms – 44.20 ms) 46.63 ms (46.49 ms – 46.82 ms) +6%

Both columns come from the same run. The codecs cross over as partitions grow. At 200 partitions (about 400 rows per partition) LZ4 halves the write, most likely because it sends far fewer bytes to the file. By 2000 they are nearly level (LZ4 3% slower), and at 8000 (about 10 rows per partition) LZ4 is 6% slower: the blocks are too small to compress well, so it mostly adds its per-block cost.

How are these changes tested?

This PR only adds benchmark code under native/shuffle/benches/; no production code changes.

  • cargo fmt --all -- --check and cargo clippy -p datafusion-comet-shuffle --all-targets -- -D warnings pass.
  • cargo bench -p datafusion-comet-shuffle --bench shuffle_writer --no-run builds.
  • Every new case runs once in Criterion's test mode: cargo bench -p datafusion-comet-shuffle --bench shuffle_writer -- --test 'shuffle_writer_high_partition/.*compression=Lz4Frame'.

Part of apache#7080.

What's added: the shuffle_writer_high_partition group (200, 2000 and 8000
hash partitions, end to end) now runs each partition count with Lz4Frame,
the default codec, next to the existing CompressionCodec::None rows. The
existing IDs are unchanged.

Code path: the per-partition write path with compression on. At 8000
partitions each partition gets about ten rows, so every block is tiny and
still pays for a fresh LZ4 frame encoder, its header and end mark; the
None row at the same partition count isolates that per-block cost.
sample_size(10), as the group already uses.

Reproduce on the VM (from native/):

    cargo bench -p datafusion-comet-shuffle --bench shuffle_writer -- 'shuffle_writer_high_partition/.*compression=Lz4Frame' --save-baseline main

Results: TODO (VM)
@github-actions github-actions Bot added the area:shuffle Shuffle (JVM and native) label Oct 24, 2026

@andygrove andygrove left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for adding the compressed rows. Measuring Lz4Frame next to None at the same partition counts is a useful comparison, and the existing None benchmark IDs are preserved.

The comment above high_partition_group still says "compression is disabled to isolate it", but the group now runs Lz4Frame as well. The paragraph you added right below it describes the Lz4Frame rows, so the two now contradict each other. Could you reword the first one so it says the None rows isolate the per-partition write path and the Lz4Frame rows add the per-block codec cost on top?

…easure

The comment above the high-partition group still said compression is
disabled to isolate the per-partition write path, which no longer holds
now that the group also runs Lz4Frame. Reword it: the None rows isolate
that path, and the Lz4Frame rows add the per-block codec cost on top.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:shuffle Shuffle (JVM and native)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants