Use ccache to cache build object files to improve build time#945
Open
Aksha1812 wants to merge 2 commits intovalkey-io:mainfrom
Open
Use ccache to cache build object files to improve build time#945Aksha1812 wants to merge 2 commits intovalkey-io:mainfrom
Aksha1812 wants to merge 2 commits intovalkey-io:mainfrom
Conversation
Signed-off-by: Aksha Thakkar <thaakb@amazon.com>
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.
Using Github Actions cache included with every github repo https://github.com/actions/cache to cache C, C++ build object files with the help of
ccache.The cache is saved under a unique key per commit (
key: ccache-...-${{ github.ref }}-${{ github.sha }}). On restore, if the exact key isn't found (new commit),restore-keysfalls back to the most recent cache from the same branch (ccache-...-${{ github.ref }}-), and if that doesn't exist either (new branch), falls back to any previous cache for that workflow (ccache-...-). This means a new PR automatically inherits the cache from its base branch, and subsequent pushes to the same PR reuse the previous push's cache. And older keys are automatically evicted.For example for unitests workflow you can Attempt # 1 took 22 minutes https://github.com/valkey-io/valkey-search/actions/runs/23844443858/attempts/1?pr=945
In Restore cache workflow you can see
I raran the workflow. For Attempt # 2 it took only 6 minutes https://github.com/valkey-io/valkey-search/actions/runs/23844443858/attempts/2?pr=945 . Since there was no file diff between the two attempts we were able to reuse all the cached build output file, so only steps remaining were docker build, icu build, linking and running unit tests
In Restore cache workflow you can see
Earlier build typically took 17 minutes, after this change it will take any time between 2-4 min assuming average number of files changed around 5-10 per change . Improving build time by 70-80% . And overall workflow time by 50-60%