title: having a global object with cluster module of node.js
body: <p>I am using clustering in the Rest api app built on express in node.js.</p>
  
  <p>the full code for Rest API utilizing clustering is.</p>
  
  <pre><code>var cluster = require('cluster');
  var numCPUs = require('os').cpus().length;
  var counter = {"color":{},"weight":{}};
  
  if (cluster.isMaster) {
  
          for (var i = 0; i &lt; numCPUs; i++) {
              cluster.fork();
          }
  
          cluster.on('exit', function(worker, code, signal) {         
              var exitCode = worker.process.exitCode;
              console.log('worker ' + worker.process.pid + ' died ('+exitCode+'). restarting...');
              cluster.fork();     
          });
  
  
  
  } else {    
  
          var express = require("express"),
          var msg;
          var server = express();     
          server.use(express.bodyParser());
          server.post('/grouper', function (req, res) {
  
              //some update on global counter         
  
          });
  
          server.listen(8080);
  
  }
  </code></pre>
  
  <p>My question is is there any way i could have a global object just like the counter object shown in code between the different forked instances so that all the instances update the same object? </p>