As any technology, this one has specific areas where it can really shine (while in other areas the benefits are not that great over current solutions). I think, one of the areas where it can really make a different, is webservices. If you have a public webservice, where you don’t want to impose a particular usage limit, then you need to support as many concurrent requests as possible and NodeJS si great for that.
I was curios what the improvement would be if I would migrate one of my PHP scripts to NodeJS. My script performs this operations:
- validate GET params
- fetch the HTML from a URL
- process the HTML (stripping HTML tags using regular expressions)
- read around 1000 keywords from the database
- check which of those keywords are found in the text (prepared in the steps above)
The test sent 1000 requests (same request, same params), with 50 concurrent requests.
The result is:
As the above graph shows, NodeJS performed better than PHP & Apache. The results was encouraging enough for me to make the switch to NodeJS (for this particular script).
The response time is pretty bad, but keep in mind this test ran locally, with only one server (no load balancing). The important result is that NodeJS was around 80% faster than PHP & Apache. On an actual production server, you would have Nginx load balancing requests to multiple NodeJS scripts (NodeJS is not yet stable enough to be send requests directly to it, in production).