Node.js UV_THREADPOOL_SIZE environment variable

810 views
Skip to first unread message

Kiki

unread,
Jul 9, 2013, 1:42:38 PM7/9/13
to nod...@googlegroups.com
One of the changes made by Ben Noordhius in Node v0.10.0 was to "honor UV_THREADPOOL_SIZE environment variable" in Unix. The "threadpool.c" source file seems to do just that. 

If I don't set this env variable, I can verify that I am limited to a threadpool of 4 threads, which is the default size of the threadpool.

But I set this environment variable on my Linux server to 64 and then restart Node, but I still seem to be limited, seemingly to a threadpool of size of 5?!

Does this make any sense to anyone? Thanks!

Ben Noordhuis

unread,
Jul 10, 2013, 5:33:18 AM7/10/13
to nod...@googlegroups.com
The thread pool is created on demand:

$ UV_THREADPOOL_SIZE=10 out/Release/node
>

From another shell:

$ ps -Lef | grep '[n]ode' | wc -l
2

Now kick off something that uses the thread pool:

> require('fs').readFile('/etc/motd', function() { })

And now the threads are there:

$ ps -Lef | grep '[n]ode' | wc -l
12
Reply all
Reply to author
Forward
0 new messages