Cluster Implementation Variations in Node
You can read more detailed explanation of the source code and clustering in node in the article: Scaling-Clustering In Node.js
npm install
-
Basic server without clustering.
Start:node serverSingle.js
-
Clustering with the
cluster
module.
Start:node serverCluster.js
-
Clustering with the
cluster
module, with process respawning.
Start:node serverClusterRespawn.js
-
Clustering with the PM2 process manager.
Install:npm install pm2@latest -g
Start:pm2 start serverSingle.js -i max
Stop:pm2 stop all
Delete:pm2 delete all
While one of the servers is running, you can do the benchmarks with:
ab -n 1000000 -c 100 -k http://localhost:3000/