Node.js Versus Nginx: Bare Bones Test

Published on Dec 4, 2012 by Jamie Munro

This is a quick follow up to yesterday’s post on Node.js Versus Apache2: Bare Bones Test where I performed a straight HTML test of Node.js versus Apache.  With my recent switch to Nginx, I thought it prudent to perform this exact same test swapping out Apache for Nginx.  The results are much more interesting to yesterday’s since there is no total destruction (sorry for the spoiler if you didn’t read yesterday’s article).




To do this test, I simply installed Nginx on my Windows 7 laptop to ensure the playing field is level and copied the HTML file created for Apache to my Nginx web root.

I then proceeded to re-run the simple speed tester on both the Node and Nginx applications, respectively.

I was much more pleasantly surprised in the results this time.  I ran the test multiple times because it was so close and each time both the Node and Nginx website ran over 6,700 times.  It would swap between Node winning by 20 results than Nginx winning by 20 results.  At the end, I would have to call it a tie since the results were always within +/- 20 of each other!

I would be curious to include php5-fpm and redo this test because at this stage I feel that Node would step out as more of the clear leader because Node is already doing some full circle processing where-as Nginx is just loading a plain jane HTML page…

Summary


Unlike Apache, Nginx seemed to be quite respectable when comparing against a basic Node.js application.  Which of course makes a lot of sense since the concepts behind them are somewhat simpler unlike Apache which follows a more blocking pattern when loading web pages.

Tags: Optimization | speed comparison | nginx | Theory | JavaScript | node | apache

Related Posts

blog comments powered by Disqus