title: On AWS node socketcluster can't connect more than 1000 connections
body: <p>I am running a simple socketcluster node.js server and connecting to it from node.js websocket client. </p>
  
  <p>By running the server on my local Ubuntu14.04, I could connect more than 10,000 clients to the server. But on AWS EC2 (c3-large) ubuntu14.04 instance the same code connects only less than 1000 connections. </p>
  
  <p>Modified the etc/security/limits.conf and set the limits for "soft nofile" and "hard nofile" to 65535 on the EC2 instance.</p>
  
  <p>Posix soft limit as suggested <a href="https://stackoverflow.com/questions/17033631/node-js-maxing-out-at-1000-concurrent-connections">Node.js maxing out at 1000 concurrent connections</a> is not helping.</p>
  
  <p>Other sysctl parameter doesn't differ much between my local ubuntu and EC2 instance.</p>
  
  <p>Latency might not be an issue, because I tried to connect to server from multiple client machines still number of connection remain &lt; 1000.</p>
  
  <p>Is there any AWS environment variable that could effect the performance?
  Is number of messages to and from EC2 could be a limitation?</p>
  
  <pre><code>var posix = require('posix');
  posix.setrlimit('nofile', {soft:10000});
  
  var SocketCluster = require('socketcluster').SocketCluster;
  var numCPUs = require('os').cpus().length;
  var numWorkers = numCPUs;
  
  var start = Date.now();
  console.log("..... Starting Server....");
  
  process.on('uncaughtException', function (err) {
      console.log("***** SEVERE ERROR OCCURED!!! *****");
      console.log(err);
  });
  
  var socketCluster = new SocketCluster({
    balancers: 1,
    workers: numWorkers,
    stores: 1,
    port: 7000,
    appName: 'mysimapp',
    workerController: __dirname + '/sim_server.js',
    addressSocketLimit: 0,
    socketEventLimit: 100,
   rebootWorkerOnCrash: true,
   useSmartBalancing: true
  });
  </code></pre>
  
  <p>--sim_server.js--</p>
  
  <pre><code>module.exports.run = function(worker) {
  var posix = require('posix');
  posix.setrlimit('nofile', {soft:10000});
  
  var connection_db = {};
  var opencount = 0;
  var closecount = 0;
  var msgcount = 0;
  
  function status()
  {
      console.log('open: ' + opencount);
      console.log('close: ' + closecount);
      //console.log('receive: ' + msgcount);
      setTimeout(function(){
        status();
      },10000);
  }
  status();
  
  websocket_server = worker.getSCServer();
  
  websocket_server.on('connection', function(socket){
      var mac;
      socket.on('mac-id', function(data) {
          opencount++;
          mac = data;
          connection_db[mac] = socket;
      });
      socket.on('message', function(data) {
          msgcount++;
      });
      socket.on('close', function() {
          delete connection_db[mac];
          closecount++;
      });
  });
  
  process.once('SIGINT', function() {
      process.exit(0);
      });
  }
  </code></pre>