Node.js, what is it??? Node.js is a software system designed for making brilliant webservers that can host scalable (rich) internet applications in an event-driven way.
Why event driven (versus thread-based)?
What do we mean with this? The webservers we are used to know, like Apache, IIS are thread-based. As soon as you start communicating with them, you have your own private communication line with the webserver. Nobody else is allowed to use that one, until you are completely done. In comparison, node.js & nginx (Thanks Bradley Wright for pointing this out), as soon as it received your request, doesn’t wait for the request to be completed and send back. It stacks the request on a queue, and goes to the next request, from someone else. So a user requesting something, is an event. Node.js stacks them up, and each them when it finished a request, will reestablish contact with the client again.
If this doesn’t make sense to you, please read Dan York’s blogpost.
An open connection between a client and a node.js application, only requires minimum memory / cpu (server-side). A test by Matt Ranney from Voxer actually made clear that they sooner ran out of ports, than cpu or memory. This means that when having about a bit less than 65535 open connections, the node.js server still continued working, without remarquable lag.
Rich internet applications?
These websites, are applications that formerly only used to be a program. Like a Calendar, Word, … . Thy process your input, and update what you did without the pages refreshes. They are connected with other users. And what you see could actually change, when somebody else changes something, somewhere else on the internet.
When should you use it?
|When should you not use it?
||When should you use it?
This table is a summary from an openminds slideshow.
What is next?
I am going to write a tutorial about setting a Node.js server up, about making a hello world application and something more complicated.
Thanks & comments!
Thanks for reading. If there are any mistakes in this articles, please comment! If you have anything to add to this, please contribute!
- http://www.slideshare.net/frank_be/nodejs-waarom-en-hoe (dutch presentation)