forked from hyperium/tonic
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Allow specifying compression encoding order #1
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grao1991
reviewed
Jun 12, 2024
CapCap
force-pushed
the
max_specify_encoding_orderings
branch
2 times, most recently
from
June 12, 2024 04:20
b1a5936
to
6f5922b
Compare
CapCap
force-pushed
the
max_specify_encoding_orderings
branch
from
June 12, 2024 04:30
6f5922b
to
b584ecd
Compare
CapCap
force-pushed
the
max_specify_encoding_orderings
branch
4 times, most recently
from
June 13, 2024 00:51
d6288d7
to
be08ac2
Compare
banool
approved these changes
Jun 13, 2024
@@ -30,22 +38,58 @@ impl EnabledCompressionEncodings { | |||
} | |||
|
|||
/// Enable a [`CompressionEncoding`]. | |||
/// Every time an encoding is enabled, it is given the lowest priority (the start of the list) | |||
/// In order to enable both `gzip` and `zstd`, and have zstd have higher priority, you would call: |
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.
Nice, good clear comment.
CapCap
force-pushed
the
max_specify_encoding_orderings
branch
from
June 14, 2024 17:37
be08ac2
to
e07fdca
Compare
CapCap
force-pushed
the
max_specify_encoding_orderings
branch
from
June 14, 2024 18:57
e07fdca
to
e7f9d3f
Compare
CapCap
added a commit
that referenced
this pull request
Jun 15, 2024
Allow specifying compression encoding order
CapCap
added a commit
that referenced
this pull request
Jun 15, 2024
Allow specifying compression encoding order
CapCap
added a commit
that referenced
this pull request
Jun 15, 2024
Allow specifying compression encoding order
CapCap
added a commit
that referenced
this pull request
Jun 15, 2024
Allow specifying compression encoding order
CapCap
added a commit
that referenced
this pull request
Jun 18, 2024
Allow specifying compression encoding order
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Although Zstd is significantly more performant (> 5x in our testing), the default chosen encoding remains Gzip when both are enabled. This blocks us from being able to gradually roll out zstd support for existing downstream clients before disabling Gzip entirely.
Solution
This PR introduces a feature that allows for specifying the order of compression encodings. The key changes include:
- Updated EnabledCompressionEncodings to support ordering/prioritizing multiple compression encodings such as Gzip and Zstd.
- Modified the enable function to reorder encodings based on the priority, ensuring the most recently enabled encoding has the lowest priority- i.e "first in highest priority"
- Added new tests to validate the correct priority ordering of compression encodings settings.
- Make sure GRPC correctly copies this order for each connection as well.
The behavior is now "given a list of supported encodings, I will pick the highest priority one that I support"