Skip to content
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

Enable wire compression in Solana CLI and Rust client #26236

Merged
merged 1 commit into from
Jun 27, 2022
Merged

Enable wire compression in Solana CLI and Rust client #26236

merged 1 commit into from
Jun 27, 2022

Conversation

steveluscher
Copy link
Contributor

@steveluscher steveluscher commented Jun 27, 2022

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

  • Enable gzip, deflate, and brotli compression in the Solana CLI and Rust client, wherever supported by an RPC provider.
  • Actually, just go and enable it everywhere.
  • Remove reqwest dependency from core, 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 new accept-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!

A screenshot of a wire proxy showing an 80% reduction in bytes over the wire when making a request for a block from an RPC

Thanks!

Thank you to @linuskendall for bringing this one to my attention!

@steveluscher steveluscher added enhancement New feature or request rust Pull requests that update Rust code labels Jun 27, 2022
@steveluscher
Copy link
Contributor Author

This PR is meant to be accompanied by #26262 so that RPC providers can measure if there's a drop in egress with the new version.

@steveluscher steveluscher requested a review from mvines June 27, 2022 18:53
@mvines mvines added the v1.10 label Jun 27, 2022
@steveluscher steveluscher merged commit 9765034 into solana-labs:master Jun 27, 2022
@steveluscher steveluscher deleted the zip-it-zip-it-good branch June 27, 2022 22:38
mergify bot pushed a commit that referenced this pull request Jun 27, 2022
(cherry picked from commit 9765034)

# Conflicts:
#	Cargo.lock
#	cli/Cargo.toml
#	client/Cargo.toml
#	core/Cargo.toml
#	download-utils/Cargo.toml
#	install/Cargo.toml
#	metrics/Cargo.toml
#	notifier/Cargo.toml
#	rpc-test/Cargo.toml
mergify bot added a commit that referenced this pull request Jun 28, 2022
Co-authored-by: Steven Luscher <steveluscher@users.noreply.github.com>
@solana-labs solana-labs deleted a comment from Bbjj88h Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants