Clustering is the most direct way to improve the throughput of your Node.js server without changing your hosting provider.
1The Master Process
The Master process is the orchestrator. Its only job is to look at the number of CPUs available (os.cpus().length) and call cluster.fork() for each one. It listens for workers dying and replaces them instantly.
2Zero-Downtime Reloads
With clustering, you can restart workers one by one. This means you can update your code and deploy it without ever stopping the service for your users. This is called a 'Rolling Restart'.
3PM2 vs. Manual Cluster
While the cluster module is powerful, manually managing it is complex. PM2 abstracts this away. Running pm2 start app.js -i max does all the master/worker logic for you automatically.
