Skip to content

Add support for zstd websocker compression#4513

Open
dpatekar wants to merge 6 commits intomainfrom
feature/socket-compression-zstd
Open

Add support for zstd websocker compression#4513
dpatekar wants to merge 6 commits intomainfrom
feature/socket-compression-zstd

Conversation

@dpatekar
Copy link
Contributor

@dpatekar dpatekar commented Feb 10, 2026

Brief Description

  • Add Zstandard (zstd) compression for WebSocket communication between microservices and the gateway, reducing bandwidth usage for large payloads
  • Compression is negotiated during authentication via a codecs field and applied automatically to outbound messages exceeding 200 bytes (auth messages are never compressed)
  • Add WS_DISABLE_OUTBOUND_COMPRESSION environment variable to opt out of outbound compression

Checklist

  • Have you added appropriate text to the CHANGELOG.md files?

Add those to list or remove the list below altogether:

Notes

When you are merging a feature branch into main, please squash merge and make sure the final commit contains any relevent JIRA ticket number. If you are merging from main to staging, or staging to production, please use a regular merge commit.

Does this introduce tech-debt? If so, have you added an entry to the Tech-debt document?

@dpatekar dpatekar requested a review from cdhanna February 10, 2026 11:39
@github-actions
Copy link
Contributor

Lightbeam link

@github-actions
Copy link
Contributor

Lightbeam link

@dpatekar dpatekar marked this pull request as draft February 11, 2026 14:51
@Leinnan
Copy link
Collaborator

Leinnan commented Feb 12, 2026

@dpatekar just out of curiosity- do you have any benchmarks on how does it affect communication by any chance?

@dpatekar dpatekar marked this pull request as ready for review February 12, 2026 14:36
@dpatekar
Copy link
Contributor Author

@dpatekar just out of curiosity- do you have any benchmarks on how does it affect communication by any chance?

Zstd has a similar compression ratio to Gzip, around 80% size reduction for JSON text, but Zstd is significantly faster (Gzip is also fast).

I wrote a benchmark comparing Zstd (ZstdSharp.Port NuGet) to .NET native Gzip with various content sizes:
image

@github-actions
Copy link
Contributor

Lightbeam link

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.

3 participants

Comments