Posts

Showing posts from September, 2011

Node.js vs PHP response time metrics

Image
I recently did a small Hello World Time Metric Test to see response time on Node.js and PHP and plotted the graph to see the performance difference between the two. PHP was hosted on a LAMP stack while node.js was downloaded via apt-get install. Instructions can be found on http://nodejs.org . The node.js script was simple hello world script: var http = require('http'); http.createServer(function (req, res) {   res.writeHead(200, {'Content-Type': 'text/plain'});   res.end('Hello World\n'); }).listen(1337, "127.0.0.1"); console.log('Server running at http://127.0.0.1:1337/'); While the PHP script used was: echo "Hello World"; ?> The tester script was: $j=0; while($j<100) { $time1=microtime(true); $i=0; while($i<10000) {     file_get_contents("http://localhost/hello.php"); $i++; } $time2=microtime(true); print($time2-$time1); print(' '); $j++; } Any gu