Setting up optimal CI builds

Skip to first unread message

Fredrik Medley

Apr 22, 2021, 8:40:30 AMApr 22
to bazel-discuss
Our presubmit checks is spenting a lot of time in Bazel, to find out that everything is remotely cached by Buildbarn. The analysis cache is unfortunately discarded because we run Bazel multiple times with different flags. How should one setup the CI system to avoid spending minutes on checking for cache hits?

We have already cut the time in Bazel by more than 50% by applying as described in My latest investigation only points to dependency graph management within Bazel and just a minority of the time is spent on actually checking for cache hit.

Ulf Jack answered in that they don't discard their analysis cache between builds. That would definitely cut our build times. How can this be done in practice?

We would like to get down to presubmit times of below one minute, inspired by Eric Burnett's talk "One minute Presubmits" at Bazel has taken us down from the 1 hour range to 10 minutes, but right now Bazel is on the critical path.

Austin Schuh

Apr 22, 2021, 12:46:03 PMApr 22
to Fredrik Medley, bazel-discuss
If you pick different output bases for each of your invocations, you can avoid invalidating your action cache at the cost of more memory usage.  The end result is one bazel instance per output base.

I haven't figured out a solution yet, but with build without the bytes, I'm unable to break the sub 3 minute mark on one of my builds.  Turning it off increases the fresh build time and decreases the incremental build time.


You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Fredrik Medley

Apr 22, 2021, 3:59:33 PMApr 22
to bazel-discuss
It reminds me of my one year old thread about keeping the analysis cache, The memory footprint and multiple external repository folders due to multiple Bazel instances is a bit scary. Do others user multiple Bazel instances with different --output_base?

Yes, we are using "build without the bytes".

Reply all
Reply to author
0 new messages