DEV Community

Chulo✨
Chulo✨

Posted on

Node.JS Architecture

What is Node.js?

description

Node.js is an open source server environment platform built on Google’s Chrome JavaScript Engine which runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.) using JavaScript on the server.

The Question May Arise, Why do we use Node?

It is light, scalable and uses event-driven architecture and non-blocking (asynchronous) tasks that run on a single thread.

description

Some Interesting Terminologies In Node.JS Architecture
NodeJS incorporates a pipeline architecture in order to efficiently interpret input data and produce the corresponding output. It follows a very modular structure, but re-mains tightly coupled to its libraries, particularly the V8 engine. Some features we can observe is seen in the way Node.js Handles Requests

Requests
NodeJS receives multiple client requests and places them into EventQueue, NodeJS has its own EventLoop which is an infinite loop that receives requests and processes them.

description

Thread Pool
A Pool allows you to create a set of workers and queue worker calls. The queued tasks are pulled from the queue and executed as previous tasks are finished.

EventQueue
The event queue is built into the operating environment that hosts the Javascript interpreter. It isn't fundamental to Javascript itself so it's not part of the actual JS runtime, but rather something made available to the Javascript environment by the host.

Event Loop
The Event Loop receives incoming requests, processes them, and then returns/Outputs the responses to the corresponding clients indefinitely.

The Node.Js Server
The task of a web server is to open a file on the server and return the content to the client. Node.js has a built-in module
called HTTP, which allows Node.js to transfer data over the Hyper Text Transfer Protocol (HTTP).

description
This Image Describes The Workflow Experienced Using Node.js.

Advantages Of Working With Node.Js

  • Node.js allows developers to use JavaScript to create server-side code, even though traditionally, this language has only been used in the browser to develop client-side code. Combining both sides in the same environment makes it easier to create web servers, which is why Node.js popularity as a handy tool for writing server code has skyrocketed.

  • Node.js offers an Easy Scalability
    One of the key advantages of Node.js is that developers find it easy to scale the applications in horizontal as well as the vertical directions. The applications can be scaled in horizontal manner by the addition of additional nodes to the existing system.

  • Node.js is used as a Single Programming Language
    Node.js offers the developers the luxury of writing the server-side applications in the JavaScript. This allows the Node.js developers to write both the front-end as well as the back-end web application in JavaScript using a runtime environment.

description

Node.js Is Best Suitable for;

  • Real-time web applications
  • Streaming applications
  • Messaging apps
  • Chat programs
  • Social media apps

All These Contribute To its popularity and growth amongst Developers.

Top comments (1)

Collapse
 
chuckzokoye profile image
Okoye Emmanuel

Nodejs is great🚀