Node.js: A Next Gen Technology (Geek to Geek)

DZone 's Guide to

Node.js: A Next Gen Technology (Geek to Geek)

Interested in learning how to use Node.js? Read on to get a great overview of this backend technology, and the pros and cons of adapting it.

· Web Dev Zone ·
Free Resource


  • Node.js is a tool to run it as a web server to build a client server application
  • It uses to Google V8 engine to execute JavaScript code
  • Built upon event driven architecture
  • By default, the only single thread is responsible for handling the client request, but we can run multiple threads on the same machine to achieve scalability and fault tolerance.
  • In order to build an application, we need to use a third-party web framework like Express, Meteor, etc.


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 are 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 Node.js

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 was originally developed to provide asynchronous I/O that includes asynchronous TCP and UDP sockets, (famous) event loops, asynchronous DNS resolution, file system read/write, 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 (requests and responses) which are 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.

Node.js Binding: A binding basically is a wrapper around a library written in one language and exposes the library to code written in another language so that pieces of code written in different languages can communicate.

C/C++ Add-ons: C/C++ Add-ons are dynamically-linked shared objects, written in C or C++, that can be loaded into Node.js using the required 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.

Node.js Suitability

  1. Suitable for:
  • Real-time web apps (chat or other applications in which a connection needs to be open).
  • If we need to build APIs.
  • Streaming applications.
  • An application which depends on I/O bound tasks.

2. Not suitable for:

  • CPU intensive task (there is, however, a workaround to achieve CPU intensive tasks).

Pros and Cons

a) Pros

  • Asynchronous event driven I/O helps concurrent request handling.
  • Uses a single programming language.
  • Delivers improved performance.
  • Easy to scale.
  • Cross-platform.

b) Cons

  • It runs on JavaScript, which is easy to learn but can lead to error prone code and has no compile-time type checking.
  • Nested callbacks.
  • Lack of robust libraries.
web dev ,node.js ,architecture

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}