Skip to content

Give linking actions more RAM#636

Open
JSGette wants to merge 1 commit intobazelbuild:mainfrom
JSGette:jsgette/bump_linker_memory_settings
Open

Give linking actions more RAM#636
JSGette wants to merge 1 commit intobazelbuild:mainfrom
JSGette:jsgette/bump_linker_memory_settings

Conversation

@JSGette
Copy link

@JSGette JSGette commented Mar 16, 2026

This addresses #628. Current formula sets 50 Mb of RAM for a single linking action which is too low and leads to bazel scheduling too many actions in parallel. This is especially painful in containerized environments (such as kubernetes) where such a behavior can easily cause OOM Killer to kill build pods.

With the new formula, first, default value is slightly higher (256 Mb) and, second, we scale more aggressively with the increasing number of inputs

@meisterT
Copy link
Member

This seems to be a drastic increase. Back when we came up with the numbers we did an extensive analysis to come up with the number. I wonder how it changed so signficantly. (cc @wilwell)

@JSGette
Copy link
Author

JSGette commented Mar 17, 2026

This seems to be a drastic increase. Back when we came up with the numbers we did an extensive analysis to come up with the number. I wonder how it changed so signficantly. (cc @wilwell)

This setting is less relevant for RBE environments where resources are managed at the cluster level (AFAIK, Google mainly relies on RBE so will barely notice this issue if ever).

Our case:
For builds on 6 GB RAM CI workers, it is critical. Bazel immediately claims 1.5 GB for its in-memory cache, but eventually needs 3 GB to handle the full action graph. Since heavy linking actions (C++/Rust) compete for the remaining RAM, the system often hits OOM limits. Using resource_set allows Bazel to throttle concurrent linking actions based on available memory, which is more scalable than manually hard-coding --jobs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants