In the world of modern Web Applications, the part of JavaScript is indispensable. JavaScript has come a long way over the years in the web development world with the help of client-side JavaScript frameworks like AngularJS, ReactJS, etc. But there is a void on the server-side. This is where Node.js came into place as a server-side JavaScript framework based on Google Chrome’s v8 engine.

What is Node.js?

Node.js is an open-source JavaScript-based framework for building server-side network applications. It is built as an asynchronous event-driven JavaScript runtime, Node.js is created to build high-performance scalable network applications. This event-driven, non-blocking Input/output model architecture makes it perfect for data-intensive, scalable, real-time applications.

Node.js is well accepted by leading companies like Netflix, LinkedIn, Uber and PayPal.

Initially, Node.js was created to build real-time websites with push capability. Inspired by applications like Gmail. Node.js creator gave developers a tool for working in the non-blocking, event-driven I/O paradigm.

After over a long period the web development frameworks were stateless, a stateless model is where data generated in one session for a user is not maintained for usage with the next session for the same user.

Finally, with Node.js there is a way to maintain session information between requests for a user. Node.js helps to have real-time two-way communications between client and server, where both server and client can initiate a communication, allowing them to exchange data easily.

Why use Node.js?

Node.js is increasing its popularity day by day but what makes it so popular among developers. Well over two decades of web applications were based on a stateless request-response paradigm were developers have to put a lot of effort to maintain the session between requests for a user.

But with Node.js web applications are stateful, now your applications are real-time and have two-way communications between client and server, both client and server can initiate a communication.

With all these advantages, Today, Node.js is widely used and plays a critical role in the tech stack of many high-profile companies, they heavily depend on its unique benefits.

How Does it Work?

Every browser uses a JavaScript engine to execute JavaScript programs which converts JavaScript into a code that a computer can understand. V8 by chrome, Spider Monkey by Microsoft Edge and Chakra by Firefox are some of the famous JavaScript engines. This is why JavaScript performs and behaves differently in different browsers.

So far, JavaScript can only be run on a browser. In 2009 Developer Ryan Dahl successfully ran JavaScript outside a browser with the help of V8, which is the faster JavaScript engine available in the web market and embedded it inside a CPP program and called it Node.

The scope of JavaScript in the browser is limited to the objects provided. But with Node, we have objects that allow us to access file systems, databases and create web servers to server data. Both chrome and Node uses the V8 engine with different runtime environment which provides different objects and tools to perform different operations.

The architecture of the Node.js mainly depends on the use of non-blocking, event- driven I/O to remain lightweight and efficient in the face data-intensive, real-time applications.


Node.js stands out well among the back-end services because of its asynchronous nature, also this is why Node.js is widely adopted by developers.

What is I/O?

Stands for Input and Output and refers primarily to interact with the system’s disk and network supported by libuv engine. Once the application is started it is loaded into the system’s memory. That’s what the CPU will mostly use for running your application.

I/O accessing memory is pretty fast, hence a lot of caching mechanism is implemented into simply storing data in RAM. However, the application will often have to load data from files and over the network and these I/O are by far the slowest types. This is where non-blocking came into place.

Blocking I/O

Blocking I/O is when the execution of the JavaScript programming process is blocked until the execution of the non-JavaScript task to complete. This happens because event-loop is unable to execute additional JavaScript while blocking operation is occurring. During this blocking period, your machine will be holding onto memory and processing time for an idle thread.

Most of the synchronous based services will spawn additional threads to execute pending requests or the developers will write their implementation to handle requests asynchronously.

But with Node.js we don’t have to worry about it since it runs asynchronously by default.

Non-Blocking I/O

Asynchronous non-blocking servers like Node executes all requests in a single thread, this means a single instance of Node makes most out of a single thread also this means the server can serve more requests with limited hardware resource which will be cost-effective.

When a request arrives at the server-side they’re processed one at a time however if any blocking I/O operation comes in between like query data from the database then it sends the callback to the second queue and it doesn’t wait and continue executing remaining requests. Now when the DB operation completes the corresponding callback is pushed to the third queue where they are pending execution. When the main thread gets time to execute something this callback will be processed.

WeCreativez WhatsApp Support
Our customer support team is here to answer your questions. Ask us anything!
👋 Hi, how can I help?