Skip to content

Commit bc510d1

Browse files
committed
Add post to call for testing of Cargo's -Zhttp-registry
1 parent 3f91948 commit bc510d1

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
layout: post
3+
title: "Call for testing: Cargo sparse-registry"
4+
author: Arlo Siemsen
5+
team: The Cargo Team <https://www.rust-lang.org/governance/teams/dev-tools#cargo>
6+
---
7+
8+
The Cargo nightly [`sparse-registry`][sparse-registry] feature is ready for testing. The
9+
feature causes Cargo to access the crates.io index over HTTP, rather than git. It can
10+
provide a significant performance improvement, especially if the local copy of
11+
the git index is out-of-date or not yet cloned.
12+
13+
## Overview
14+
To try it out, add the `-Z sparse-registry` flag on a recent nightly build of Cargo.
15+
For example, to update dependencies:
16+
17+
```
18+
rustup update nightly
19+
cargo +nightly -Z sparse-registry update
20+
```
21+
22+
The feature can also be enabled by setting the environment variable
23+
`CARGO_UNSTABLE_SPARSE_REGISTRY=true`. Setting this variable will have no effect on stable
24+
Cargo, making it easy to opt-in for CI jobs.
25+
26+
The minimum Cargo version is `cargo 2022-06-17`, which is bundled with `rustc 2022-06-20`.
27+
28+
You can [leave feedback on the internals thread][internals].
29+
30+
If you see any issues [please report them on the Cargo repo][cargo]. The output of Cargo
31+
with the environment variable `CARGO_LOG=cargo::sources::registry::http_remote=trace` set
32+
will be helpful in debugging.
33+
34+
## Details
35+
36+
Accessing the index over HTTP allows crates.io to continue growing without hampering
37+
performance. The current git index continues to grow as new crates are published,
38+
and clients must download the entire index. The HTTP index only requires downloading
39+
metadata for crates in your dependency tree.
40+
41+
The performance improvement for clients should be especially noticeable in CI
42+
environments, particularly if no local cache of the index exists.
43+
44+
On the server side, the HTTP protocol is much simpler to cache on a CDN, which improves
45+
scalability and reduces server load.
46+
47+
The Cargo team plans to eventually make this the default way to access crates.io
48+
(though the git index will remain for compatibility with older versions of Cargo and
49+
external tools). `Cargo.lock` files will continue to reference the existing crates.io
50+
index on GitHub to avoid churn.
51+
52+
The `-Z sparse-registry` flag also enables alternative registries to be accessed over
53+
HTTP. For more details, see the [tracking issue][tracking-issue].
54+
55+
## Thank you
56+
57+
This project has been in the works for over 2.5 years with collaboration from the crates.io,
58+
infra, and Cargo teams.
59+
60+
[@kornelski](https://github.com/kornelski) wrote the [sparse-index RFC][rfc] and initial
61+
performance proof of concept. [@jonhoo](https://github.com/jonhoo) created the initial
62+
implementation in Cargo and gathered performance data. [@arlosi](https://github.com/arlosi)
63+
completed the implementation in Cargo and implemented the changes to crates.io to serve the
64+
index. [@eh2406](https://github.com/eh2406) provided numerous reviews and feedback to get
65+
all the changes landed. Many others from the community helped by providing suggestions,
66+
feedback, and testing.
67+
68+
Thank you to everyone involved!
69+
70+
[rfc]: https://rust-lang.github.io/rfcs/2789-sparse-index.html
71+
[sparse-registry]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#sparse-registry
72+
[internals]: https://internals.rust-lang.org/t/call-for-testing-cargo-sparse-registry/16862
73+
[tracking-issue]: https://github.com/rust-lang/cargo/issues/9069
74+
[cargo]: https://github.com/rust-lang/cargo/issues

0 commit comments

Comments
 (0)