Wednesday, November 13, 2013

Node.js under the hood

In ten years of java development, I have mainly been involved with stateless  "pull" technologies:
The term connectionless is also used to describe communication in which a connection is made and terminated for each message that is sent. IP is connectionless as well as stateless.

With Node.js, it is a platform that fills a particular need :

  • don’t want to use Node.js for CPU-intensive operations 
  • Node.js operates on a single-thread, using non-blocking I/O calls
  • capable of handling a huge number of simultaneous connections with high throughput, which equates to high scalability
The main idea of Node.js: use non-blocking, event-driven I/O to remain lightweight and efficient in the face of data-intensive real-time applications that run across distributed devices.
Now,  that last phrase, Non-Blocking I/O. You will never hear anywhere, from anyone, that Node.js is non-blocking.

Further details:
avoiding the need for OS threads by simply refusing to wait. Rather than making blocking IO calls, wherein the thread stalls waiting for the call to return, almost all IO calls in Node.js are asynchronous, wherein the thread continues without waiting for the call to return. In order to handle the returned data, code in Node.js passes callback functions to each asynchronous IO call. An event loop implemented within Node.js keeps track of these IO requests and calls the callback when the IO becomes available.
It uses event driven concurrency

five talks learn more nodejs

1 comment:

  1. Hello, I Like your blog, I wanted to leave a little comment to support you and wish you a good continuation. Wish you best of luck for all your best efforts. Hire Node Js Developers