← Back to Blog

To understand Bazel build costs, separate the infrastructure bill from the estimates you allocate to builds and actions. Connect resource pricing and allocation data to execution records, document the attribution model, and retain costs that cannot be assigned. A per-action estimate can help prioritize investigation; it does not become an invoice or a guaranteed saving.

Start with three different cost questions

A cloud invoice answers what you paid for resources over a billing period. Kubernetes allocation asks how those costs are assigned to workloads. Build attribution asks which actions or invocations should receive a share. Keep the period, cluster coverage and units consistent before combining these records.

OpenCost’s allocation specification distinguishes resource allocation, shared overhead and idle costs. The allocation policy matters: unused capacity still needs an owner in your accounting, even when it cannot be attached to an executing action.

  • Infrastructure cost: compute, storage, network and supporting services over a defined period.
  • Attributed execution estimate: a documented share assigned to an action, target or invocation from the evidence available.
  • Developer waiting time: a separate estimate of human impact. Queue delay is not itself a worker CPU charge, and overlapping developer activity can make a simple hourly-rate calculation misleading.

For the commercial question of who pays for infrastructure and operating work, compare deployment options. Paying a service fee and paying the infrastructure bill are separate parts of the evaluation.

Collect the evidence the question needs

Bazel’s Build Event Protocol supplies build and test context. It does not provide a cloud invoice or a complete worker-cost record. Correlate invocation identity with the relevant execution and infrastructure sources rather than deriving dollars from BEP alone.

For Buildbarn, configured completed-action records can provide execution timing and worker context. The execution components separate scheduling, worker orchestration and command execution. Verify which records your deployment emits and which identifiers let you join them to a build.

Document the node or worker rates, time window, currency, discounts and resources included. Keep storage, network, idle capacity and shared services visible when they are outside an action-level model. Missing prices or incomplete execution records are unmeasured costs, not zero-cost builds.

Make the attribution model explicit

A duration-based estimate combines action execution time with an appropriate worker or node rate. When several actions share a worker, define how the rate is divided among them; charging each action the full node rate can count the same capacity repeatedly. Elapsed execution time multiplied by a requested CPU count is an assumption about allocation, not a measurement of CPU consumption.

State whether the estimate accounts for memory, input and output transfer, storage, idle time and supporting services. Reconcile the sum against the infrastructure allocation over the same period, and retain an unallocated remainder rather than forcing every dollar onto an action.

Use the resulting estimates to compare equivalent workloads and investigate expensive actions. Summing them into a target or build total also needs a policy for shared work, retries and incomplete records. Do not describe an estimate as the exact cost of every invocation.

Correctly interpret changes in cache hit rate

Consider a hypothetical fixed population of 10,000 cache lookups. At an 85% hit rate, 1,500 miss. At a 70% hit rate, 3,000 miss. The hit rate fell by 15 percentage points, while the miss count doubled: that is 100% more misses, not 15% more.

Those counts do not establish a matching change in remote executions or spend. Check which misses led to remote work, whether actions had comparable resource demands, and whether execution or allocation policy changed. Local execution, other cache layers and retries can affect the relationship.

Likewise, fewer executions do not automatically reduce a fixed infrastructure bill. Realized savings depend on reducing paid capacity, billable usage or another actual charge. Keep modeled execution cost, capacity released and money saved as separate outcomes. Use the remote-cache troubleshooting guide to verify the behavior before assigning a benefit.

What Hermetiq’s cost views depend on

The data-source documentation describes OpenCost-based infrastructure allocations and per-action estimates using execution duration and worker/node pricing available through VictoriaMetrics. These are allocations and estimates, rather than direct cloud billing invoices.

Availability depends on the deployment, connected sources, permissions, pricing and attribution data. Connecting OpenCost alone does not enable every cost view, and BEP alone does not supply the required infrastructure pricing. Confirm the enabled cost-report integration and its coverage for the project you will use.

Begin with one representative build and an agreed time window. Check ingestion completeness, available action records, pricing and shared-cost treatment. Compare the estimate with infrastructure allocation, then investigate changes using the same definitions. Record any missing inputs beside the result.

Choose an improvement you can verify

Use evidence to decide whether the next task is fixing avoidable cache misses, changing worker capacity, reducing expensive work or investigating storage and transfer overhead. A high hit rate alone does not establish low cost or a faster build.

Record the configuration and workload before changing them. Afterward, check build correctness, timing, allocated usage and the billable resource that was expected to change. A successful performance experiment and a verified reduction in spend are different results.

Investigate build costs with the right evidence.

Connect a representative build, then confirm the infrastructure and execution sources needed for cost analysis. See how it works.

Self-host Hermetiq

Related reading