-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Cache usage meta tracking issue #7150
Copy link
Copy link
Open
Labels
A-cachingArea: caching of dependencies, repositories, and build artifactsArea: caching of dependencies, repositories, and build artifactsC-tracking-issueCategory: A tracking issue for something unstable.Category: A tracking issue for something unstable.E-hardExperience: HardExperience: HardS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Z-mtime-on-useNightly: mtime-on-useNightly: mtime-on-use
Metadata
Metadata
Assignees
Labels
A-cachingArea: caching of dependencies, repositories, and build artifactsArea: caching of dependencies, repositories, and build artifactsC-tracking-issueCategory: A tracking issue for something unstable.Category: A tracking issue for something unstable.E-hardExperience: HardExperience: HardS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Z-mtime-on-useNightly: mtime-on-useNightly: mtime-on-use
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
No status
This issue is to help provide an overview of the different issues around Cargo's excessive disk usage, and tangentially, reducing compile time by reusing artifacts in a shared cache.
Cleaning outdated artifacts
Cargo's
targetdirectory can grow substantially over time. It has limited capabilities to clean it withcargo clean. Also, in general,cargo cleanhas a fair number of bugs and is generally underwhelming.Various issues and links of interest:
cargo-sweep— A tool to prune unused files.-Z mtime-on-useflag is an experiment to have Cargo update the mtime of used files to make it easier for tools likecargo-sweepto detect which files are stale.I think a way forward here is to experiment and investigate different ways for tracking artifacts and last-use timestamps.
mtime-on-usehas an issue with cached files in Docker. The filename hash is opaque and doesn't provide any insight into the metadata which would inform whether or not an artifact could be removed.Cargo currently tracks a variety of things in different ways. It has a
.jsonfingerprint file which is generally unused (only for debug logging). It also has aninvoked.timestampfile used for some change tracking. And mtime information is used in a few different ways. It might be interesting to experiment with a different way to coordinate all this information. Perhaps a single, unified file tracking all artifacts, or changing the way the per-artifact.jsonfile works. The key points is that it must be fast and reliable, and should work well in Docker.Cleaning cargo's home
Cargo's home directory
~/.cargogrows without bounds. There is currently no built-in way to shrink it.The
cargo-cachepackage is the foremost way to manage it currently (besidesrm -rf). Ideally some of this would be a built-in capability of Cargo.The main issue tracking this is #3289 — cargo clean
~/.cargo.There has not been much discussion about this. Ideally cargo would have this capability built in, perhaps with some of the easier/safer tasks automated on a periodic basis.
Reusing shared dependencies
sccacheis the primary way to share artifacts across projects. It is also possible to share targets with setting theCARGO_TARGET_DIRenvironment variable.Issues:
Since this has the potential to use a substantial amount of disk space, it would be desirable to have better support for pruning as listed above.
There are a fairly large number of tools which dig into the
targetdirectory. They would all be broken by this change, so we would need to figure out a strategy for migration before doing this. I began this in #6668, but I have not finished. Ideally #6668 and #6577 would be finished before making this change.