Remote caching should be a strategy
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the feature request:
When configuring Bazel to use a remote cache *without* remote execution, the remote cache is not exposed as a strategy as far as I can tell. (Bazel does print `remote-cache` in the list of strategies when scheduling an action, but this value cannot be explicitly selected via strategy flags, so it is misleading.)
The use of a remote cache should be a strategy that works well with any other strategy, such as dynamic, and can be selectively enabled for individual actions.
### What underlying problem are you trying to solve with this feature?
We are facing two issues when remote caching is enabled:
1. It is not possible to configure Bazel so that certain actions use the cache and other actions skip it, yet we need to do this for build performance reasons and to minimize network traffic. The `remote-cache` magic identifier cannot be passed to `--strategy`. More context in https://github.com/bazelbuild/bazel/issues/18244.
2. It is not possible to combine the use of remote caching with the dynamic strategy. When remote caching is enabled, as soon as Bazel scores a cache hit for an action, it will patiently wait for the outputs of the action to be downloaded. If you consider a "slow" network and very large artifacts, this is a big problem: many times it's silly to wait for the download because re-running the action locally would have generated the output much sooner.
### Which operating system are you running Bazel on?
N/A
### What is the output of `bazel info release`?
bazel-6.1.1
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?
_No response_
### Have you found anything relevant by searching the web?
_No response_
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Research direction
No source files, tests, or entry points are named. Start by tracing Bazel's strategy selection and remote-cache scheduling, then determine how explicit per-action selection and dynamic execution should interact; done means remote caching can be selected as a strategy, combined with dynamic, and selectively enabled.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100