-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Cargo fetching registry extremely slow when cargo does it but not with manual git command #9177
Comments
This is unfortunately likely a libgit2 issue which we don't have a ton of control over. We try to report bugs upstream when we can but it sometimes takes awhile to reduce and/or fix them. |
Thanks for checking! We worked around it with some hacky cache-like fixes that we could do as we have full control over the server on which the CI runs on, so we don't have this issue anymore. |
If you are no longer experiencing the problem then I will close for now. If you want to try to isolate something we can report upstream, then we can re-open or start a new one. |
Yeah, |
Looks like some form of |
Recently introduced sparse protocol effectively mitigates the issue. And it is the default since 1.70. |
We have landed shallow clone support via For libgit2, maybe? The steps for that route is first waiting for a new release and then updating
Depends on what do you mean by “deprecated completely”. I believe git registry will still be there for a long while, but yes, now Cargo favors sparse registry. |
Problem
When utilizing cargo in CI we have noticed that the download of the registry, during
Updating crates.io index
, is extremely slow on the order of 5-20 min (and sometimes failing), which is stalling our CI pipelines.To experiment we tried running a build locally after deleting
.cargo/registry
and saw the same slow speed, however if we run the git command manually, i.e.git fetch --force --update-head-ok 'https://github.com/rust-lang/crates.io-index' 'refs/heads/master:refs/remotes/origin/master' 'HEAD:refs/remotes/origin/HEAD'
, it downloads at ~10 MB/s.So the slowdown only seems to happen when cargo is running the command.
Steps
.cargo/registry
(as with a CI running a clean build).Updating crates.io index
will take 5-20 min with download speed in the range 10-300 kB/s.Notes
Output of
cargo version
:cargo 1.50.0 (f04e7fab7 2021-02-04)
OS:
Linux 5.10.16-arch1-1 #1 SMP PREEMPT Sat, 13 Feb 2021 20:50:18 +0000 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: