loading...

re: Is Node.js really single-threaded? VIEW POST

TOP OF THREAD FULL DISCUSSION
re: So does this mean that there's no advantage in running Node on a super beefy 16 core machine?
 

It's a practice to spawn multiple instances of the app with this type of setup.
Have a look at cluster module.

nodejs.org/api/cluster.html

 

Also check nodejs.org/api/worker_threads.html and threads.js.org/
You can truly have multiple threads now in Node. Handling Race condition is on you though, for now atleast. Best use case for workers is for logging and I/O operations.

 

To get started with multiple instances, have a look at pm2. You can spawn as many instances as your cpu cores.

pm2.keymetrics.io/

Code of Conduct Report abuse