title: Scalable architecture for socket.io
body: <p>I am new to socket.io and Node JS and I am trying to build a scalable application with a high number of simultaneous socket connections (10,000+).</p>
  
  <p>Currently, I started on a model where my server creates child process, and every child process listens a specific port with a sicket.io instance attached. Once a client connects, he is redirected on a specific port.</p>
  
  <p><strong>The big question is : Does having several socket.io instances on several ports increases the number of possible connections ?</strong> </p>
  
  <p>Here is my code, just in case :</p>
  
  <p>Server</p>
  
  <pre><code>var server = http.createServer(app);
  
  server.childList = [];
  for (var i = 0; i &lt; app.portList.length; i++) {
    server.childList[i] = require('child_process').fork('child.js');
  }
  
  server.listen(3443, () =&gt; {
    for (var i = 0; i &lt; app.portList.length; i++) {
      server.childList[i].send({ message: 'createServer', port: app.portList[i] });;
    }
  });
  </code></pre>
  
  <p>child.js :</p>
  
  <pre><code>var app = require('./app');
  var http = require('http');
  var socket_io        = require( "socket.io" );
  
  process.on('message', (m) =&gt; {
      if (m.message === 'createServer') {
  
          var childServ = http.createServer(app);
  
          childServ.listen(m.port, () =&gt; {
              console.log("childServ listening on port "+m.port);
          });
  
          var io = socket_io();
          io.attach( childServ );
  
          io.sockets.on('connection', function (socket) {
              console.log("A client just connected to my socket_io server on port "+m.port);
          });
      }
  });
  </code></pre>
  
  <p>Feel free to release the kraken if I did something horrible there</p>