To expand on Alpha's point a bit, just a shared cache (without execution) can be quite helpful, but requires a fairly specific set of circumstances:
- Multiple builds being run that would hit a remote cache, but not already have results locally. E.g. clean builds can get value from a shared cache, but incremental ones less so.
- Toolchains that either emit machine-independent results, or multiple machines having the same key characteristics.
- Keying such that cache values that shouldn't be reused won't be, but still allow for cache hits. E.g. object files from the wrong version of gcc should probably not be picked up.
So examples environments where this can be useful:
- Sharing between CI machines that are all running the exact same hardware and software. This one is easy - almost anything that can be cached locally should be able to be safely cached remotely too.
- Sharing between users, IF you know they're running the same hw/sw, OR you're sharing the results from tools where mis-versioning won't have a negative effect, OR you have good enough keying to pick up only the transferrable actions from the graph.
I generally assume that this is going to be surprisingly difficult for most people, and that getting this right gets you most of the way to being able to do remote execution anyways. But I've definitely heard from folk (including Alpha) who have environments that allow them to usefully capitalize on shared caches, so I'm not going to say that it cannot be done :).
Couple other misc things to think about:
- Using bazel well can often have better impact directly than relying on a remote cache. E.g. if you can arrange it so you do incremental builds instead of clean builds (in your CI setup for example), I'd expect that to bring you most of the benefits of a remote cache at a lot less effort.
- Toolchains can have surprising coupling to the machines they run on, making results non-portable. E.g. C++ debug info often embeds absolute paths.
- ...though some tool results will be trivially cacheable. E.g. if you had an action in bazel to minify pngs, I'd be surprised if you couldn't trivially cache the results of that. But that'll be specific to your particular workload, and what actions within it are both cacheable and expensive.
Cheers,
Eric