Re:Piscina – The Node.js Worker Pool
by barefeg on Tuesday March 23, 2021 @03:37PM
(#26559388)
I’m guessing the fact that node is single threaded
[ Parent
| on HN ]
JavaScript is single threaded, Node is most certainly not.
Yes it surely is
My "htop" display surely disagrees. So do my node programs that lag out waiting for disk IO thread pool slots. Sounds does node's documentation: https://nodejs.org/api/worker_threads.html
It's not exactly. Certain operations like I/O are threaded in Node. libuv has it's own threadpool that it uses for a lot of these types of tasks.
Node uses a thread pool for tasks like reading files async and crypto operations etc, you can read about it here https://nodejs.org/en/docs/guides/dont-block-the-event-loop/