Explore caching strategies for CI builds #847
Labels
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
Infra
Things related to CI/CD, build, and tests
For CircleCI, we download a 4GB cache (which is everything from the Bazel run) and it takes about 2 minutes. Then for every job we also upload a new copy of the Bazel cache, which takes about 6 minutes. So every job, even incremental rebuilds take at least 8 minutes.
stratum/.circleci/config.yml
Lines 6 to 31 in 09ddb5a
We can likely do better...
One proposal is to use the CircleCI cache for remote repositories and a new remote Bazel cache for build artifacts. With two fully populated caches, here are some preliminary results:
Build stats with --repository_cache and --remote_cache:
< 3 minutes, 950MB downloaded, 24MB uploaded
/tmp/cache
is 1.2GB and only changes when a dependency is updatedWe can also simplify the caching strategy because all deps are specified in one file:
- bazel-repo-cache-v1-{{ checksum "bazel/deps.bzl" }}
Further optimization is likely possible but also risks cache bloat, so paying the one time cost for a new cache in the infrequent dependency update event seems like a fair tradeoff. One goal is to avoid uploading a Bazel cache at the end of each job, which is a costly operation.
The text was updated successfully, but these errors were encountered: