Enable wire compression in Solana CLI and Rust client #26236
Merged
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.
Problem
Are you feeling SQUEEZED? Has life got you in a VICE? Is the PRESSURE getting to you? Well SQUEEZE BACK!
JSON is a terrible wire format, full of redundant markup and waste. The easiest mitigation for this is to employ a wire compression algorithm, like gzip. Savings can be as much as 80%.
Wire compression, however, works better when you turn it on.
Summary of Changes
reqwest
dependency fromcore
, where it is – in fact – not used.Test plan
This PR doesn't need to be tested, per se, because the implementation of the HTTP header-crafting and response decompression is already tested as part of the Rust
reqwest
crate.Here's a run of
cargo run block 125791054
with a proxy on the wire. You can see the newaccept-encoding
header being sent in the request, and Triton's RPC proxy responding with a gzipped response body. 80% reduction in bytes over the wire too!Thanks!
Thank you to @linuskendall for bringing this one to my attention!