-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Maintain multiple analyses in analysis cache #14179
Comments
@irfansharif Unfortunately, I don't have any code left from my experiments of not deleting the analysis cache. I threw it away as it didn't work. |
I want to signal boost https://groups.google.com/g/bazel-discuss/c/vgn9uyyIrIM/m/4trNkRS0AQAJ - @moroten 's discussion listed above The biggest challenge is addressing correctness concerns. Partial approaches could be viable, with trim_test_configuration as precedent. |
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team ( |
FYI, a decent workaround is to use the |
To clarify @matts1 workaround: changing |
That's correct, yeah |
We can see two improvements to this:
|
Could we reopen this issue, since it remains relevant and is being actively discussed? |
Yes: https://www.youtube.com/watch?v=op4gIYxucjE is a BazelCon 2024 about the cross-build analysis caching. We are still working on the internal reference implementation of this, and will prioritize Bazel support after that. |
Since this issue is specifically about
|
Just to be clear, who still cares about this beside @pauldraper , @tpudlik , and @matts1 ? These comments span over a few years. |
Description of the problem / feature request:
Bazel seems to maintain only one analysis in the analysis cache. Whenever a relevant flag is changed, we purge the cache in its entirety. This adds to build time even with a 100% cache hit rate for the build artifacts (see repro below). Workarounds I've seen so far suggest using a different output_base for each set of flags, which is pretty cumbersome and uses a ton of cache space. Envoy's gotten around by sharing the same set of flags for both build and test, but that's not always possible and is a stop gap for bazel preserving earlier analyses in the analysis cache for possible future re-use.
Feature requests: what underlying problem are you trying to solve with this feature?
It's a common workflow to switch between building and testing a bazel project. For us that entails using different
--define
and--test_env
flags, which discards the analysis cache entirely. If bazel's maintaining only one copy of the analysis cache (from the last bazel invocation), we end up doing a lot of extra work to re-analyze the build despite 100% of the build artifacts being present in the remote cache. Maintaining multiple analyses in the analysis cache, each tagged with whatever compiler options they're safe to use with, would help us cut the iteration time down substantially. This also holds true for CI, where even if all the necessary artifacts are present, thrashing the analysis cache results in us doing a lot of unnecessary work.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
With https://github.com/cockroachdb/cockroach:
Observe that when switching between
bazel build
andbazel test
, despite have a 100% disk cache hit, it takes ~25s for the execution to complete as a result of not having an earlier run's analysis cache data to consult. Compare it to when it is available:What operating system are you running Bazel on?
MacOS Big Sur.
What's the output of
bazel info release
?release 6.0.0-pre.20211019.1, though the same problem exists with 4.0.0 onwards.
Have you found anything relevant by searching the web?
Some other threads on the mailing list: https://groups.google.com/g/bazel-discuss/c/EdBvMEPrH5A and https://groups.google.com/g/bazel-discuss/c/vgn9uyyIrIM/m/4trNkRS0AQAJ.
Github: #11194, #12113 (comment).
Stack Overflow: https://stackoverflow.com/questions/53012722/why-does-bazel-do-a-full-rebuild-whenever-switching-between-intellij-and-command
The text was updated successfully, but these errors were encountered: