I am using a cluster and trying to figure out what is the best way to define variables.
1 - var config
if (cluster.isMaster) {
2 - var config
// master code
for (var i = 0; i < numCPUs; i++) {
cluster.fork()
}
}else{
// worker code
3 - var config
}
is it the same to declare variable anywhere and each worker will have its own independent copy of the variable ?