Skip to content

Support cargo build --load-average / -l like GNU make #7480

Closed as not planned

Description

@devurandom

Describe the problem you are trying to solve

I am trying to limit the load on my system while building Rust software.

Describe the solution you'd like

GNU make supports a make -l4 / make --load-average=4 parameter, that allows me to limit the target system load to 4 (e.g.). It would be nice, if Cargo would support the same.

Activity

  1. added
    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
    on Oct 4, 2019
  2. guanqun commented on Oct 28, 2019

    @guanqun

    I did some quick googling and found this answer: https://stackoverflow.com/a/13355071 . It seems the author prefers using a -j option, and in cargo, the -j option is implemented, do you think you can use that instead to limit the load?

  3. devurandom commented on Oct 28, 2019

    @devurandom
    Author

    -j does not care about the load on the system. Keep in mind that many processes can create load, not just make or cargo. Spawning many compilation tasks, where each uses -j N (or worse, unbounded -j), can bring a system to halt. -l M prevents that reasonably well.

    I think the author of that answer also makes the mistake of passing an unbounded -j in combination with -l. If one passes a limit as in -j 6 -l 4, then make will spawn up to 6 processes, but only when the load does not exceed 4.

  4. jaccc commented on Apr 11, 2021

    @jaccc

    it would be useful

  5. added
    S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
    A-jobserverArea: jobserver, concurrency, parallelism
    A-build-executionArea: anything dealing with executing the compiler
    on Nov 2, 2023
  6. weihanglo commented on Nov 2, 2023

    @weihanglo
    Member

    Not aware of this issue until today! Seems like it is #8556 with a specific solution in mind

  7. epage commented on Nov 3, 2023

    @epage
    Contributor

    Closing in favor of #12912 so we keep the conversation in one place.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-build-executionArea: anything dealing with executing the compilerA-jobserverArea: jobserver, concurrency, parallelismC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions