Using the cluster module
Your application can take advantage of multi-core systems and run more than one process (using node's cluster
module).
The configuration cluster
setting allows you to set the number of processes you want to run.
When the cluster
option is set to true
then the number of processes will match the number of cores on your server.
You can also directly specify the number of processes you want.
If that number is less than 1, or if you specify false
, then you application won't run in a cluster and will just have a single process.
If that number is greater than the number of cores then the actual number of cores will be used instead.
// config/production.js
export default {
...
cluster: true, // Use all cores
// cluster: 3, // Only use three cores
...
}