简体   繁体   中英

Nodejs child process max cpu`s as limit

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 ?

Unless affinity is set for a process, eg 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 (eg database).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM