Get os.cpus().length to match Linux container CPU quota.
const getCpusLength = require("get_cpus_length");
+ console.log("CpusLength: ", getCpusLength());
- console.log("CpusLength: ", require("os").cpus().length);
npm install get_cpus_length
or
yarn add get_cpus_length
When your kubernetes is set up Resource Management for Pods and Containers, this problem occurs Not correct os.cpus().length inside the docker container with cpus limited. #28762.