Skip to content

Add separate compression settings for the streaming exchange of distributed plans, default LZ4 - #126743

Merged
davenger merged 4 commits into
masterfrom
exchange-compression-method
Oct 20, 2026
Merged

davenger merged 4 commits into
masterfrom
exchange-compression-method

Conversation

@davenger

@davenger davenger commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

The streaming exchange between the tasks of a distributed query plan (make_distributed_plan) compressed its packets with network_compression_method. Since its default changed to ZSTD (level 3) in #108786, the exchange spends much more CPU time on compression than it saves on the network: the exchange connects nodes of one cluster, and it compresses every packet once and reads it once.

This PR adds two settings for the exchange:

  • distributed_plan_exchange_compression_method, default LZ4. The values are the same as for network_compression_method. An empty value uses network_compression_method and network_zstd_compression_level as before; compatibility below 26.11 sets it.
  • distributed_plan_exchange_zstd_compression_level, default 1, used when the exchange method is ZSTD.

The receiver reads the codec from each compressed block, so nodes of different versions can exchange data.

On TPC-H SF100 with 8 nodes the sum of server times is 27.4 s with the exchange on ZSTD and 23.7 s with LZ4, with the same plans.

Changelog category (leave one):

  • Performance Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

The streaming exchange of a distributed query plan compresses with LZ4 by default instead of the codec of network_compression_method. New settings distributed_plan_exchange_compression_method and distributed_plan_exchange_zstd_compression_level choose the codec.

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/126743]

Version info

  • Merged into: 26.11.1.308-master (included in 26.11 and later)

…lan_exchange_zstd_compression_level`, default `LZ4`

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [73576ba]

Summary: ✅


AI Review

Summary

Separates streaming exchange compression from native connection compression, defaults the exchange to LZ4, and preserves legacy codec selection through an empty setting or compatibility. No actionable findings in the current diff.

Missing context / blind spots
  • ⚠️ No local build or test execution was performed. The current-head targeted CI report has not published test results yet; passing runs of 05218_distributed_plan_exchange_compression_codec and 05407_distributed_plan_exchange_compression_default would close this execution gap.
Final Verdict

Status: ✅ Approve, subject to the normal CI checks completing successfully. No code changes requested.

@clickhouse-gh clickhouse-gh Bot added the pr-performance Pull request with some performance improvements label Oct 19, 2026
…der an older `compatibility`

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added the comp-distributed Distributed table engine & query routing across shards (sharding/load balancing). label Oct 19, 2026
…nstead of a compression ratio

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 73576bac9 with master bf66cb9c1 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 9450a0993; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

8 translation units recompiled, 20 s compile time in total, 8 of them have a recent master baseline.

Job report

…t are not counted as runs

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@CheSema CheSema self-assigned this Oct 20, 2026
Comment thread src/Core/Settings.cpp
- 'Streaming' - stream exchange data over network.
)", EXPERIMENTAL, \
{"25.5", "", "", "New experimental setting."}) \
DECLARE(String, distributed_plan_exchange_compression_method, "LZ4", R"(

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.

I saw that settings could be enum,
in that case we could check the value at the configuration level.
But I assume that the way to use string here has been set a time ago and now it too hard to change.

@davenger davenger Oct 20, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think it might be more flexible to have it as a string potentially allow passing codec params like 'ZSTD(1)'

@davenger
davenger added this pull request to the merge queue Oct 20, 2026
Merged via the queue into master with commit 6cf960b Oct 20, 2026
352 of 354 checks passed
@davenger
davenger deleted the exchange-compression-method branch October 20, 2026 13:47
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 20, 2026
@clickhouse-gh clickhouse-gh Bot added comp-distributed-query-exchange Distributed Query Execution with Exchange operators: cloud-native query distribution using stream... and removed comp-distributed Distributed table engine & query routing across shards (sharding/load balancing). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-distributed-query-exchange Distributed Query Execution with Exchange operators: cloud-native query distribution using stream... pr-performance Pull request with some performance improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants