-
Notifications
You must be signed in to change notification settings - Fork 101
Cirrus: Improve caching effectiveness #553
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
Cirrus: Improve caching effectiveness #553
Conversation
03e9876
to
36c9b14
Compare
For comparison: About one minute of time was saved by re-using the targets cache. However, downloading the cache took 43 seconds 😢 I'm doing something wrong. |
7243dc7
to
e213870
Compare
okay, my aging memory recalls now. The super beneficial cache to maintain is the Cargo cache. That's the real time-saver when it comes to rebuilding stuffs. I've added some new perpetration commands for it to the grooming script. |
e213870
to
3032315
Compare
Mhh the timings do not look right, As I understand the build task should take longer since it has to compile from scratch but the validate and unit test task should use the build cache from the build task. This looks way to slow now. |
@Luap99 All tasks subsequent to In anycase, I'll take a look at the other tasks shortly, thanks for pointing them out. |
3032315
to
7045e66
Compare
Timings look much better now, although I wonder why aarch64 still looks much slower compared to the older PRs. But maybe this is just a one off. Also I found rust-lang/cargo#5026, which explains why target dir just keeps increasing. Basically every time as the rust toolchain is updated we need clean that dir in the future. |
The way cache is setup now, it's keyed on a pr-by-pr basis. For branches, it's keyed on the branch-name. So the first run in a PR or new branch, cache will be cold. Then subsequent re-runs (in the same PR) will benefit from a warm cache. I did it this way to thwart accidental or intentional pollution/poisoning from one PR to another. If you think it's safe for PRs to share cache, I can make that change. I just defaulted to "most-safe" as a matter of habit.
Oh interesting, yep that's got to be the problem. It also explains why the github action goes to such lengths as reading config files and checking mtimes. I didn't know there was a |
7045e66
to
607f4d5
Compare
Prior to this commit, the cache maintained for the main branch has grown to over 16gigabytes. Attempts to upload it are causing frequent branch- level CI failures due to being larger than the maximum allowable. Attempt to fix this by introducing a cache-grooming script and altering the cache-keys to track with dependency specification and build settings. Content for the grooming script comes mainly from three places: 1. [Cargo documentation](https://doc.rust-lang.org/nightly/cargo/guide/build-cache.html) 2. The rust-cache github action [(typescript) source code](https://github.com/Swatinem/rust-cache/tree/master/src) 3. This [cargo home in CI section](https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci) For branch-level cache, the grooming script will completely clobber it's cache at loosely-random intervals determined by the Cirrus Build ID. This is intended to prevent the cache from growing indefinitely. It's an non-ideal solution in a space full of very limited possibilities. Signed-off-by: Chris Evich <[email protected]>
607f4d5
to
c361afa
Compare
Okay, I think this PR is ready now. I tried to document what's happening as best as I could. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cevich, flouthoc, Luap99 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Port of containers/netavark#553 Signed-off-by: Chris Evich <[email protected]>
Port of containers/netavark#553 Signed-off-by: Chris Evich <[email protected]>
Port of containers/netavark#553 Signed-off-by: Chris Evich <[email protected]>
Port of containers/netavark#553 Signed-off-by: Chris Evich <[email protected]>
Port of containers/netavark#553 Signed-off-by: Chris Evich <[email protected]>
Port of containers/netavark#553 Signed-off-by: Chris Evich <[email protected]>
Prior to this commit, the cache maintained for the main branch has grown
to over 16gigabytes. Attempts to upload it are causing frequent branch-
level CI failures due to being larger than the maximum allowable.
Attempt to fix this by introducing a cache-grooming script and altering
the cache-keys to track with dependency specification and build settings.
Content for the grooming script comes mainly from three places:
For branch-level cache, the grooming script will completely clobber it's
cache at loosely-random intervals determined by the Cirrus Build ID.
This is intended to prevent the cache from growing indefinitely. It's an
non-ideal solution in a space full of very limited possibilities.