NodeJS: A Next Gen. Technology (Geek to Geek)

NodeJS: A Next Gen. Technology (Geek to Geek)



Application code gets compiled by V8 (JavaScript engine developed by google to use in Chrome). The code communicates with low-level Node.js components via bindings. All the events written in the code are registered with Node.js. Once events are triggered, they are enqueued in the event queue according to the order that they are triggered. As long as there still are remaining events in the event queue, the event loop keeps picking them up, calling their callback functions, and sending them off to worker threads for processing. Once a callback function is executed, its callback is once again sent to the event queue, waiting to be picked up by the event loop again.

Components of NodeJs

V8: V8 is Google’s open source high-performance JavaScript engine, written in C++ and used in Chromium, Node.js and multiple other embedding applications

libuv: libuv is originally developed to provide asynchronous I/O that includes asynchronous TCP & UDP sockets, (famous) event loop, asynchronous DNS resolution, file system read/write, and etc. libuv is written in C.

Other low level components

c-ares: c-ares is a C library for asynchronous DNS requests (including name resolves)

HTTP parser: This library is used to parse HTTP messages (request and response) which is written in C

OpenSSL: OpenSSL is an open source project that provides a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols.

zlib and many others.

Node.js Binding: a binding basically is a wrapper around a library written in one language and expose the library to codes written in another language so that codes written in different languages can communicate.

C/C++ Add-ons: C/C++ Addons are dynamically-linked shared objects, written in C or C++, that can be loaded into the Node.js using the require function, and used just as if they were an ordinary Node.js module. They are used primarily to provide an interface between JavaScript running in Node.js and C/C++ libraries.

Node.js API: Node.js API is an abstraction upon other low level modules and is the interface with built in libraries.

Application: Node.js application code

Node.Js suitability

  1. a) Suitable for
  1. b) Not suitable for

Pros and Cons

a) Pros

b) Cons

Exit mobile version