Skip to content

Feature request: os: os.availableProcessors() #28855

Description

@NicolasSchwarzer

Is your feature request related to a problem? Please describe.
It's unable to get actual available amount of processors in a docker container running on image node:10.16.0, of which cpus is limited by docker container resource constraints. For detail information, please have a look at issue #28762.

Describe the solution you'd like
Provide os.availableProcessors() api to get the actual available amount of processors.

Describe alternatives you've considered
If possible, it's better to fix the output of os.cpus().length, e.g. by using Proxy to change the value of length property. Because most node modules use os.cpus().length to decide how many processes it should fork, which may exceed the limitation of cpus in the docker container.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.osIssues and PRs related to the os subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions