Reputation: 3264
i see a lot of examples ,libraries and even in the cluster documentations example that they limit the number of running process to the same number of cpu`s.
does creating a child_process will ensure getting the process thread pinned to a specific cpu or it just a recommendation for making the Os scheduler life easier ?
Upvotes: 2
Views: 3099
Reputation: 222379
Unless affinity is set for a process, e.g. with nodeaffinity
, the use of CPU cores is governed by OS. This is not specific to child processes or Node.js, the same applies to any process.
Maximum amount of children is set to a number of cores by default because a greater amount would result in processes competing over same cores and less efficient multithreading. The amount may vary in both directions depending on the benchmarks. Sometimes it may be beneficial to leave cores free for non-Node CPU intensive processes (e.g. database).
Upvotes: 2