clickhouse-compression

command
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

README

ClickHouse Compression Bench

One-off bench used to validate enabling LZ4 client compression (#909 / #911).

Alternates Compression off / LZ4 / ZSTD against the same CH instance, tags each insert with a query_id, then pulls exact wire bytes from system.query_log.ProfileEvents['NetworkReceiveBytes'] for comparison.

Run

# Local dev CH (build/dev/deps/compose.yml --profile clickhouse)
CLICKHOUSE_ADDR=localhost:29000 \
CLICKHOUSE_USERNAME=outpost \
CLICKHOUSE_PASSWORD=outpost \
CLICKHOUSE_DATABASE=outpost \
  go run ./cmd/bench/clickhouse-compression --batches=5 --rows=100000

# Remote (CH Cloud, TLS)
CLICKHOUSE_ADDR=<host>:9440 \
CLICKHOUSE_USERNAME=<user> \
CLICKHOUSE_PASSWORD=<pass> \
CLICKHOUSE_DATABASE=<db> \
CLICKHOUSE_TLS_ENABLED=true \
  go run ./cmd/bench/clickhouse-compression --batches=10 --rows=10000

Flags

flag default meaning
--batches 5 runs per mode
--rows 10000 rows per batch
--modes off,lz4,zstd subset of codecs to test
--keep false keep the throwaway table on exit

The bench creates a bench_compression_<rand> MergeTree table and drops it on exit (no schema/migration dependency). Payload is ~700-byte JSON representative of event bodies.

Documentation

Overview

Bench for ClickHouse client-side compression (issue #909).

Alternates inserts with Compression off / LZ4 / ZSTD against the same CH instance and reports wall-clock, throughput, and exact wire bytes pulled from system.query_log via tagged query_ids.

Env (same names as the app):

CLICKHOUSE_ADDR          required, host:port
CLICKHOUSE_USERNAME      default "default"
CLICKHOUSE_PASSWORD      default ""
CLICKHOUSE_DATABASE      default "default"
CLICKHOUSE_TLS_ENABLED   "true" to enable TLS

Flags:

--batches    runs per mode (default 5)
--rows       rows per batch (default 10000)
--modes      comma-separated subset of off,lz4,zstd (default all)
--keep       keep the temp table on exit

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL