-
Notifications
You must be signed in to change notification settings - Fork 700
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use jobserver in wasm-builder to limit concurrency of spawned cargo p…
…rocesses (#4946) When building multiple runtimes in parallel, each of them will try to use the concurrency set by the parent cargo process. For example, in a system with 8 cpu cores, building 3 runtimes in parallel creates 8 * 3 tasks. This results in the system hanging because of the high cpu and memory usage. This PR allows the substrate_wasm_builder to use the same [jobserver][1] as the parent cargo process, making all invocations of cargo share the same concurrency pool. So in a system with 8 cores, there will never be more than 8 tasks running at the same time. Implementation roughly based on [cargo][2] but with less unsafe. This can be tested by telling cargo to use half the cpu cores, like `cargo build -j4` in an 8 core machine. Before this PR it will use 100% cpu when building 2 runtimes in parallel, after this PR it will always use 50%. [1]: https://doc.rust-lang.org/cargo/reference/build-scripts.html#jobserver [2]: https://github.com/rust-lang/cargo/blob/d1b5f0759eedf5f1126c781c64232856956069ad/src/cargo/util/context/mod.rs#L271 --------- Co-authored-by: Bastian Köcher <git@kchr.de>
- Loading branch information
1 parent
2982bf3
commit fee481f
Showing
5 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters