Skip to content

feat: add opt-in Zstd WebSocket compression - #6634

Open
ResuBaka wants to merge 1 commit into
clockworklabs:masterfrom
ResuBaka:compression/zstd
Open

ResuBaka wants to merge 1 commit into
clockworklabs:masterfrom
ResuBaka:compression/zstd

Conversation

@ResuBaka

@ResuBaka ResuBaka commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Description of Changes

This adds support for zstd as compression. This is done as in benchmarking and overall information out there zstd is the faster and better compression compared to gzip and brotli.

Here are also some numbers.

Numbers are (compress-/decompress- time in µs/size).

v2 fixture Raw B gzip level 1 Brotli quality 1 Zstd fast-2
Padded live update (~1 KiB) 1,072 8.66 / 5.20 / 365 12.85 / 53.69 / 365 2.44 / 0.90 / 325
Padded live update (~16 KiB) 16,432 33.94 / 21.00 / 4,073 148.45 / 119.45 / 3,852 18.61 / 6.90 / 3,469
Noisy subscription snapshot (~64 KiB) 65,570 234.09 / 142.05 / 48,177 1,290.01 / 605.96 / 47,813 143.67 / 25.86 / 47,398
Noisy subscription snapshot (~1 MiB) 1,048,610 3,911.02 / 2,272.05 / 768,718 20,476.22 / 8,582.86 / 764,098 1,659.71 / 416.50 / 746,730
Random live update (~16 KiB) 16,432 66.68 / 3.15 / 16,455 187.40 / 51.84 / 16,448 5.10 / 2.01 / 16,445

So in cases where the bottleneck is CPU side of compression when bandwith saving is important on the server this would bring a got win.

API and ABI breaking changes

All changes are save for each client as it is an Opt-in feature.

Rollback safety impact

The changes are in general save for the server. But could cause problems for clients that allready had changed to use zstd. So a rollback could cause problem those.

Expected complexity level and risk

1 as we it just adds a new compression option which is an opt-in

Testing

Testing was done via the new added test that messages can be encryped and decryped correctly.

@sephirith

Copy link
Copy Markdown
Contributor

@JasonAtClockwork Do we have an ETA on this one?

This branch has not been deployed

No deployments
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.

2 participants