-
-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(gateway): support zstd-stream
#2400
base: main
Are you sure you want to change the base?
Conversation
5e2c486
to
98b8ae9
Compare
It was how we used to do it, but we had multiple people ask for ways to disable it thus we made it optional in #700. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple small comments
2d33124
to
444a108
Compare
zstd-stream
57edeaa
to
6bd7057
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a couple small documentation changes
self.ctx | ||
.reset(zstd_safe::ResetDirective::SessionOnly) | ||
.expect("resetting session is infallible"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good for now, but if we see memory grows over time or something we should switch it to just recreating the ctx.
Co-authored-by: Erk <[email protected]>
Adds support for
zstd-stream
1 transport compression using Facebook's reference implementation (written in C) and deprecates ourzlib-stream
support.I did not run into any build dependency issues on macOS, Linux, or Windows as Zstd-safe seems to statically link against Zstd. Otherwise there is a pure Rust implementation of Zstandard called ruzstd which we may eventually switch to.
This PR deprecates the
zlib-stock
andzlib-simd
features since they are replaced by thezstd
feature. While doing this, I opted to not expose the previousInflater
type and itsprocessed
andproduced
properties as those are not tracked by Zstd itself.Edit: more radically, should we unconditionally use Zstd transport compression? It's like an implementation detail (or a foot gun).
Update: no, transport compression is bad for shards behind a Gateway proxy.
Footnotes
https://discord.com/blog/how-discord-reduced-websocket-traffic-by-40-percent ↩