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

Change default Rust distribution downloads from .tar.gz to .tar.xz #2399

Merged
merged 3 commits into from
Jan 5, 2024

Conversation

dtolnay
Copy link
Contributor

@dtolnay dtolnay commented Jan 5, 2024

Rust infra folks requested that I send this change.

According to Rust's logs, currently 30% of bytes served by static.rust-lang.org are .gz tarballs, and primarily that is attributed to Bazel according to user-agent.

The .gz tarballs are needlessly large and consume more bandwidth for Rust than we want to serve.

This PR changes rules_rust to default to .xz tarballs instead. Rustup has been using xz downloads for the past 6.5 years.

The default set of tars downloaded by rules_rust (rustc, rust-std, cargo, clippy, rustfmt, llvm-tools) is 215M in gz and 127M in xz, which is 41% smaller. If adopted, this PR would save static.rust-lang.org more than 12% of its bandwidth.

As a tradeoff, decompressing that set of 6 files with xz is slower: 3.6 seconds for gz and 8.4 seconds for xz. (Single-threaded. If Bazel extracts different files in parallel than the magnitude of the difference would be smaller but the ratio is similar.)

In rust-lang/infra-team#89 we intend to sunset gz downloads, or do something to push users away from them (such as throttling), so gz will be the wrong choice no matter what. To make up for decompression speed we are investigating providing zstd tarballs in rust-lang/infra-team#97 which decompress significantly faster than gz while being not much larger than xz.

Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me, thanks!

@UebelAndre UebelAndre enabled auto-merge (squash) January 5, 2024 19:24
auto-merge was automatically disabled January 5, 2024 19:27

Head branch was pushed to by a user without write access

@UebelAndre UebelAndre merged commit df73e91 into bazelbuild:main Jan 5, 2024
3 checks passed
@dtolnay dtolnay deleted the xz branch January 5, 2024 21:43
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.

None yet

2 participants