Has anyone tried to use the UV_THREADPOOL_SIZE environment variable?

One of the changes made by Ben Noordgy to Node v0.10.0 was to "read the UV_THREADPOOL_SIZE environment variable" on Unix. The source file "threadpool.c" seems to do just that.

If I do not set this env variable, I can verify that I am limited to the thread flow of 4 threads, which is the default size for threadpool.

But I set this environment variable on my Linux server to 64 and then restarted Node, but I'm still apparently limited, apparently, in threadpool size 5 ?!

Does this make any sense to everyone? Thanks!

+6
source share
1 answer

It seems you should install it var with the node command or from within the node program. Run it like this:

UV_THREADPOOL_SIZE=64 node 

or change from the program:

 process.env.UV_THREADPOOL_SIZE=64 //then execute some function that requires threadpool require('fs').readFile('testing',function(){}); 

Thread Testing:

 ps -Lef | grep "\<node\>" | wc -l 67 
+7
source

Source: https://habr.com/ru/post/949035/


All Articles