Skip to content
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

chore(ci): various optimizations for build processing, caching and concurrency #996

Conversation

jakobmoellerdev
Copy link
Contributor

@jakobmoellerdev jakobmoellerdev commented Oct 21, 2024

Our caches are getting too big:

Approaching total cache storage limit (58.09 GB of 10 GB Used)

On top we dont make use of makes inbuilt parallelism (-j) and also we do not make use of shells forking mechanism for concurrent execution (& execution chain followed by wait)

What this PR does / why we need it

Limits the cache save to only the main branch in the build step, all other branches/PRs and Jobs will reuse that cache instead of computing their own

What does this mean:

PRO:

  • only one cache that should roundabout have 4 (build files for all platforms) + 2 (build+test files for unit tests on amd64) Gi of modules and builds that get updated on every commit to main
  • The build cache is likely unaffected or largely still valid for most if not every PR. This leads to compile time improvements upwards of 600% depending on PR size without killing our cache usage.

CON:

  • a rebuild or dependency changes will be able to "invalidate" that cache and could lead to longer build times faster. However in general, most builds should still perform the same. If the go.mod / go.sum is not touched, the build cache will be restored for all files except the ones touched or impacted by the PR.

Which issue(s) this PR fixes

fix #999 #1000

@github-actions github-actions bot added the chore label Oct 21, 2024
@jakobmoellerdev jakobmoellerdev force-pushed the chore/optimize-cache-restore-and-save branch from 66ae90d to d6f1da8 Compare October 21, 2024 14:56
@jakobmoellerdev jakobmoellerdev force-pushed the chore/optimize-cache-restore-and-save branch from d6f1da8 to adb5ab6 Compare October 21, 2024 15:00
@jakobmoellerdev jakobmoellerdev changed the title chore(ci): optimize build to only save cache on build in main, all other jobs should restore only chore(ci): various optimizations for build processing, caching and concurrency Oct 21, 2024
@jakobmoellerdev jakobmoellerdev force-pushed the chore/optimize-cache-restore-and-save branch from 18bfbc8 to 6f07e3a Compare October 21, 2024 20:16
@jakobmoellerdev jakobmoellerdev force-pushed the chore/optimize-cache-restore-and-save branch from f30d0e5 to b026f78 Compare October 21, 2024 22:47
@jakobmoellerdev jakobmoellerdev marked this pull request as ready for review October 22, 2024 06:47
@jakobmoellerdev jakobmoellerdev requested a review from a team as a code owner October 22, 2024 06:47
@jakobmoellerdev
Copy link
Contributor Author

@hilmarf could you take another look here

@hilmarf hilmarf added this to the 2024-Q4 milestone Oct 28, 2024
@hilmarf
Copy link
Member

hilmarf commented Oct 28, 2024

General question: what do we want to build as fast as possible? (What requires really the best cache setup?)

  • Release builds?
  • PR builds?
    • Dependency updates?
    • Feature builds?
    • Bug fixes?
  • Hotfixes?
  • ... ?

@jakobmoellerdev
Copy link
Contributor Author

General question: what do we want to build as fast as possible? (What requires really the best cache setup?)

  • Release builds?

  • PR builds?

    • Dependency updates?
    • Feature builds?
    • Bug fixes?
  • Hotfixes?

  • ... ?

All build steps using go dependencies should be accelerated as much as possible. I would like to keep build times in the low 5 minutes, so also all PR builds.

However due to our exorbitantly large cache, the tradeoff is to reuse only one build cache from release builds as well as test steps on main.

@jakobmoellerdev jakobmoellerdev merged commit 65d6534 into open-component-model:main Nov 4, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🔒Closed
Development

Successfully merging this pull request may close these issues.

Extreme Cache Thrashing in our Github actions
3 participants