-
Notifications
You must be signed in to change notification settings - Fork 592
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
Investigate options for Bazel remote caches #12458
Comments
So far we experimented with Google Cloud Storage and Buildbuddy as remote caches. We found that the "Bazel build & test" workflow takes ~1h20m without cache and ~30m with cache. That is still slower than the current approach using the Github Actions cache. We are still experimenting with parameters that configure how much data Bazel downloads from remote caches. |
As the MCF already has an AWS account, we are also looking into setting up buchgr/bazel-remote on AWS. |
Regarding
This is discussed in bazelbuild/bazel#4558 TLDR: Bazel does not track tools outside its workspace. So if a devcontainer upgrade comes with a new version of gcc, Bazel may retrieve outputs from cache that were built with the old gcc version. To deal with that, we can
Another thread where several people suggest to hash the build-environment inputs and use that as a cache key: https://forum.buildkite.community/t/any-experience-setting-up-a-shared-remote-build-cache-using-bazel/1119/4
|
Comparison of the build times for bazel-remote and buildbuddy and different
|
Comparison of https vs grpcs protocols for
|
Build time | Protocol | Additional flags |
---|---|---|
58.810s | https |
|
56.162s | grpcs |
|
41.307s | https |
--remote_download_toplevel |
40.124s | grpcs |
--remote_download_toplevel |
14.996s | https |
--remote_download_minimal |
14.826s | grpcs |
--remote_download_minimal |
A total of 1.2 GB of remote cache was generated in the initial build for this example. This does not include the external dependencies that are only fetched but not build, which are unfortunately not cached when using a remote cache - see bazelbuild/bazel#6359.
Findings
- At least in this setup I do not see a significant decrease (as suggested by this blog post) in the build times when using
grpcs
overhttps
. It thus seems reasonable to continue usinghttps
(which avoids any authentication issues related togrpcs
for the full AWS setup). - Contrary to the findings in the above investigation I find that
--remote_download_minimal
leads to significantly faster builds than the--remote_download_toplevel
flag. This could be affected by the connection speed vs. compute power ratio on themagma-vm
vs GH runners.
See also #12353 |
Findings regarding
|
I happened upon this issue randomly but have a few comments to offer since I happen to know a bit about this topic. Re: "Findings regarding --experimental_remote_downloader"
To measure the impact of caching external deps with Depending on the shape of your build graph and external deps required by the targets you're building (the external deps of these targets will be the items that are fetched), you should definitely be seeing some difference in timings (maybe even a slowdown). You also may want to manually unset Next up--for your comparison of minor followup: |
Cross-posting here: "Bazel test options lead to different cache entries than the build options" #13073 |
Closing this issue as the remote cache has been running for some months and we are now in a phase of optimisation. |
This ticket tracks efforts in the investigation of remote caches for Bazel.
Motivation
We are currently using Github Actions cache for Bazel builds in the CI.
These come with some challenges:
By using remote caches, we are not limited to 10 GiB. Also, downloading cache results is much more fine-grained which can reduce the amount of data downloaded and hopefully abolish the need to maintain code that clears the cache in our runners.
The text was updated successfully, but these errors were encountered: