Skip to content Skip to sidebar Skip to footer

How To Create A Thread Pool In Nodejs?

So out of curiosity, I was thinking of creating my own thread pool in nodejs from which I can run number of threads in parallelly? Been looking to webworker-threads and npool but n

Solution 1:

Yes there is an open source project on git called Threads a gogo written for node.

TAGG: Threads à gogo for Node.js Threads à gogo (*) is a native module for Node.js that provides an asynchronous, evented and/or continuation passing style API for moving blocking/longish CPU-bound tasks out of Node's event loop to JavaScript threads that run in parallel in the background and that use all the available CPU cores automatically; all from within a single Node process.

Installing the module

With npm:

npm install threads_a_gogo
From source:

git clone http://github.com/xk/node-threads-a-gogo.git
cd node-threads-a-gogo
node-gyp rebuild
# It also works with node-waf, but this is outdated, so please use node-gyp nowdays.
To include the module in your project:

var threads_a_gogo= require('threads_a_gogo');

https://github.com/xk/node-threads-a-gogo

Post a Comment for "How To Create A Thread Pool In Nodejs?"