title: NodeJS vs PHP+Apache performance test has weird results
body: <p>I am trying to choose the best technology for my API so I've created the simplest script ever:</p>
  
  <p><strong>PHP:</strong></p>
  
  <pre><code>&lt;?php
  
  $r = [];
  
  for($i=0;$i&lt;=1000000;$i++) {
      $r[] = $i;
  }
  
  echo json_encode($r);
  </code></pre>
  
  <p><strong>Node:</strong></p>
  
  <pre><code>var http = require("http");
  
  http.createServer(function(request, response) {
      var i, ret = [];
  
      response.writeHeader(200, {"Content-Type": "text/html"});
  
      for(i=0;i&lt;=1000000;i++) {
          ret.push(i);
      }
  
      response.end(JSON.stringify(ret));
  }).listen(8080);
  </code></pre>
  
  <hr>
  
  <p>Apache has a pretty default configuration without and is clean of fancy optiomizations</p>
  
  <p>The response time is about 1.5s-2.3s for both PHP+Apache and NodeJS which is really weird..So do I do something wrong with node or its just that this specific functionality has no advantage over PHP+Apache?</p>
  
  <hr>
  
  <p>The API should ultimatley recieve calls, insert it to a database on one side and on the other side it should fetch those results. The api should recieve about ~1million calls per day and it should be scalable so i'm trying to figure out what is the best approach here and the performance test results confused me a bit.</p>