title: Node.js a lot better in ab without clustering, what I'm missing?
body: <p><strong>Update 1</strong>: @BagosGiAr tests with a quite similar configuration shows the cluster always should perform better. That is, there is some problem with my configuration, and I'm asking you to help me find out what could be.</p>
  
  <p><strong>Update 2</strong>: I'd like to go in deep of this problem. I've tested on a LiveCD* (Xubuntu 13.04), same node version. First thing is that, with Linux, performances are way better than Windows: <code>-n 100000 -c 1000</code> gives me 6409.85 reqs/sec without cluster, 7215.74 reqs/sec with clustering. Windows build has definitely a lot of problems. Still I want to investigate why this is happening only to me, given that some people with a similar configuration perform better (and clustering performs well too).</p>
  
  <p>*It should be noted that LiveCD uses a RAM filesystem, while in Windows I was using a fast SSD.</p>
  
  <p>How this is possible? Shouldn't result be better with <code>cluster</code> module? Specs: Windows 7 x64, Dual Core P8700 2.53Ghz, 4GB RAM, Node.js 0.10.5, ab 2.3. Test command line is <code>ab -n 10000 -c 1000 http://127.0.0.1:8080/</code>.</p>
  
  <pre><code>var http = require('http');
  
  http.createServer(function (req, res) {
      res.end('Hello World');
  }).listen(8080);
  </code></pre>
  
  <p>Benchmark result ~ <strong>2840.75 reqs/second</strong>:</p>
  
  <pre class="lang-none prettyprint-override"><code>This is ApacheBench, Version 2.3 &lt;$Revision: 1430300 $&gt;
  Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
  Licensed to The Apache Software Foundation, http://www.apache.org/
  
  Benchmarking 127.0.0.1 (be patient)
  
  
  Server Software:        
  Server Hostname:        127.0.0.1
  Server Port:            8080
  
  Document Path:          /
  Document Length:        12 bytes
  
  Concurrency Level:      1000
  Time taken for tests:   3.520 seconds
  Complete requests:      10000
  Failed requests:        0
  Write errors:           0
  Total transferred:      870000 bytes
  HTML transferred:       120000 bytes
  Requests per second:    2840.75 [#/sec] (mean)
  Time per request:       352.020 [ms] (mean)
  Time per request:       0.352 [ms] (mean, across all concurrent requests)
  Transfer rate:          241.35 [Kbytes/sec] received
  
  Connection Times (ms)
                min  mean[+/-sd] median   max
  Connect:        0    0   7.1      0     505
  Processing:    61  296 215.9    245    1262
  Waiting:       31  217 216.7    174    1224
  Total:         61  297 216.1    245    1262
  
  Percentage of the requests served within a certain time (ms)
    50%    245
    66%    253
    75%    257
    80%    265
    90%    281
    95%    772
    98%   1245
    99%   1252
   100%   1262 (longest request)
  </code></pre>
  
  <p>With cluster module:</p>
  
  <pre><code>var cluster = require('cluster'),
      http = require('http'),
      numCPUs = require('os').cpus().length;
  
  if (cluster.isMaster) {
      // Fork workers
      for (var i = 0; i &lt; numCPUs; i++) {
          cluster.fork();
      }
  
      cluster.on('exit', function (worker, code, signal) {
          console.log('worker ' + worder.process.pid + ' died');
      });
  } else {
      http.createServer(function (req, res) {
          res.end('Hello World');
      }).listen(8080);
  }
  </code></pre>
  
  <p>... and with the same benchmark, result is worst: <strong>849.64 reqs/sec</strong>:</p>
  
  <pre class="lang-none prettyprint-override"><code>This is ApacheBench, Version 2.3 &lt;$Revision: 1430300 $&gt;
  Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
  Licensed to The Apache Software Foundation, http://www.apache.org/
  
  Benchmarking 127.0.0.1 (be patient)
  
  
  Server Software:        
  Server Hostname:        127.0.0.1
  Server Port:            8080
  
  Document Path:          /
  Document Length:        12 bytes
  
  Concurrency Level:      1000
  Time taken for tests:   11.770 seconds
  Complete requests:      10000
  Failed requests:        0
  Write errors:           0
  Total transferred:      870000 bytes
  HTML transferred:       120000 bytes
  Requests per second:    849.64 [#/sec] (mean)
  Time per request:       1176.967 [ms] (mean)
  Time per request:       1.177 [ms] (mean, across all concurrent requests)
  Transfer rate:          72.19 [Kbytes/sec] received
  
  Connection Times (ms)
                min  mean[+/-sd] median   max
  Connect:        0    1  21.3      0     509
  Processing:    42 1085 362.4   1243    2274
  Waiting:       27  685 409.8    673    1734
  Total:         42 1086 362.7   1243    2275
  
  Percentage of the requests served within a certain time (ms)
    50%   1243
    66%   1275
    75%   1286
    80%   1290
    90%   1334
    95%   1759
    98%   1772
    99%   1787
   100%   2275 (longest request)
  </code></pre>