node.js UV_THREADPOOL_SIZE
mpodolsk opened this issue · 2 comments
First things first, I don't think the node.js can out perform golang.
That being said when running a SYSCALL heavy code with a lot of delegation you should bump the thread pools size from 4 to 128 at least (using the env UV_THREADPOOL_SIZE).
More docs here:
http://docs.libuv.org/en/v1.x/threadpool.html#thread-pool-work-scheduling
This is a fantastic call out. Definitely something I didn't even know existed, and totally bad on my half
Surprisingly little people know, even among the ones working in node.js full-time.
Most people don't look at uvlib until they start hitting strange perf issues.
This setting is not a magic button that makes everything go faster, as per http://docs.libuv.org/en/v1.x/design.html not all things go to these threads.
However if all thread workers are busy and you have work for them you will start seeing major lags, on top of that the design mentions mainly file I/O and DNS operations, so you may be surprised what actually goes into that pool. (some crypto calls use it as well).
Some of the things depend on what OS (windows vs linux) is running node.
Great presentations