Repository navigation
Move NuGet caches to the temp drive on Windows runners - #5991
Open
danielmarbach wants to merge 1 commit into
Open
danielmarbach wants to merge 1 commit into
danielmarbach wants to merge 1 commit into
Conversation
Contributor
Author
|
I think we can always move this into some centralized action but the biggest benefit is certainly here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The Windows jobs spend a lot more time in
dotnet restorethan the Linux ones do for the same work. On GitHub-hosted Windows runners the checkout andRUNNER_TEMPare onD:, but the default NuGet package and HTTP caches live in the user profile onC:. @bording pointed at this write-up, which points at exactly that, and wanted to see whether it applies to us.What changes
A small composite action,
.github/actions/nuget-cache-location, pointsNUGET_PACKAGESandNUGET_HTTP_CACHE_PATHatRUNNER_TEMP. It only does anything on GitHub-hosted Windows runners. It runs right after checkout in the Windowsbuildandcompilejobs inci.ymland inbuild-windows.yml. I made it an action so we have one copy of the logic instead of three.Measurements
I ran a throwaway workflow (not part of this PR) on
windows-latestthat doesdotnet restore srcfollowed bydotnet build src --configuration Release --no-restore -graph. Averages over six runs per variant, three for the SDK one:actions/cache, warmD:Restore is about 3.5 times faster and the job is roughly a minute shorter. Windows ends up about 12s behind Linux instead of over a minute. The build step itself doesn't change. It also varies a lot between runs (120s to 177s on every variant, Linux included), so the job totals carry about 30s of noise. The restore gap is well outside that.
What I tried that didn't help
actions/cacheon top of the temp drive saves about 9s of restore, but restoring the cache costs about 15s. A cold run pays around 50s to save it. I dropped it.D:doesn't help here, becausewindows-latestalready ships the SDK andsetup-dotnettakes about 2s.dotnet-install.ps1intoD:\dotnettook about 17s.D:.Open points
master.C:\Program Files\dotnetinci.yml. They're small and I haven't measured them, so I can't say whether they're worth moving.runner.environment == 'github-hosted'guard is there because I don't know how our self-hosted or larger runners are laid out. Happy to drop it if that's not a concern.