Reputation: 1
hello.js:
var http = require(‘http’);
while(true){
console.log(process.env.UV_THREADPOOL_SIZE);
}
I monitor the process and threads with 'pstree -p | grep node' after starting the program above.
I have tried 3 ways to edit thread size but none of them works: 1) Set the paramters when starting: 'UV_THREADPOOL_SIZE=100 node hello.js' 2) add path in the etc/profile and reboot the system:export UV_THREADPOOL_SIZE=100 3) add 'process.env.UV_THREADPOOL_SIZE=100' in the code.
the results of the monitor are the same:
There is only 5 threads work in the node process (4 are work threads and 1 is loop thread)
My nodejs is v6.9.x. Have anyone used this successfully?
Upvotes: 0
Views: 1298
Reputation: 11
You can set the environment variable UV_THREADPOOL_SIZE , as of this writing the max limit is 128.
If you want you can also set this env variable within your node app rather than at the shell.
Upvotes: 1