What is node?
Breaking the borders
Node’s internal architecture :
The goal :
There are 3 major feature in node’s architecture, to archive this goal.
1 ) Single threaded :
Unlike the most (web)server which spawns a thread for every incoming request, node only uses one thread. This avoids context switching. You may think, 1 thread sounds like a bottle neck? Well consider reading about the C10k problem and go on reading ;)..
2) Non blocking I/O :
But wait.. didn’t I just say it’s single threaded… Well in the one hand it is.. In the other it’s not.. Let’s have a closer look.
3) Event Loop ( Node_threading_model) :
The (single threaded) event loop uses Marc Lehmann’s libev. Actually, the event loop is indeed single threaded. To be able to answer to new incoming requests as soon as possible, long running jobs will be handed over to internal worker threads.When doing slow I/O operations such as reading a database,the program does not wait.Instead,it immediately continues to the next line of code.When the I/O operation returns,it triggers a callback function and the result can be processed.If the
More information on Node.Js