This link purely specifies that libuv
provides a thread pool which can be used to run user code and get notified in the loop thread. Its default size is 4, but it can be changed at startup time by setting the UV_THREADPOOL_SIZE
environment variable to any value. (the absolute maximum is 128).
So, in package.json
, I set scripts
field as below (NOTE: I am using Windows 7, Node JS 8.11.3, nodemon, express 4.16),
Code snippet from package.json
.
.
.
"scripts": {
"start": "SET UV_THREADPOOL_SIZE = 120 && node index.js",
},
.
.
.
Code for index.js
var express = require('express');
var app = express();
var server = app.listen(3000, function(){
console.log('LIBUV Threads: ', process.env.UV_THREADPOOL_SIZE); // this returns 'undefined'
});
How can I be assured that thread pool size is set? I want to print it out here in index.js
as above.
undefined
. – Dyl