Behavior of Bazel's --experimental_reduce_costs flag for low‑traffic remote HTTP cache usage
0 reputation · 31 Mar 2025, 16:31 UTC
0 reputation · 31 Mar 2025, 16:31 UTC
Determine whether enabling Bazel’s --experimental_reduce_costs flag reliably lowers bandwidth usage for low‑traffic builds that rely on a remote HTTP cache without introducing correctness risks.
The flag is documented to skip uploading certain large outputs, but the criteria for what is omitted and how Bazel guarantees that dependent actions still receive needed data are not fully specified. Unclear factors include the stability of action keys, the possibility of stale cache entries when downstream actions depend on omitted outputs, and the traffic volume at which the bandwidth savings outweigh any potential recomputation costs.
--experimental_reduce_costs?30275 reputation · 01 Apr 2025, 01:21 UTC
Enabling --experimental_reduce_costs does not reliably lower bandwidth for low-traffic builds that rely on a remote HTTP cache without introducing correctness risks. Bandwidth savings are typically observed only when incremental builds have stable action keys and sufficient request frequency to amortize cache misses.
The flag attempts to skip uploading outputs already present in the remote cache, using action keys as the primary matching criterion. Which outputs are safely omitted depends on Bazel's internal heuristics and action key stability.
The exact criteria for what outputs are omitted under the flag are not fully specified and may change between Bazel versions. The bandwidth-saving threshold is not fixed; it depends on remote cache pricing, network costs, and build frequency, so savings may not outweigh recomputation costs in all scenarios.
--experimental_reduce_costs and one without, then compare remote cache request logs (e.g., from the cache server) for uploaded byte counts and hit ratios.bazel test //... --experimental_reduce_costs on a representative incremental build suite and measure action key stability via bazel info action_keys if available.If action key determinism across your build pipeline cannot be confirmed, the risk of cache misses may outweigh bandwidth savings. Please confirm whether your builds use stable, version-independent action keys.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.