Closed
Description
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.