What is Nodejs and its Importance?

Sakshi Bhardwaj
4 min readJan 30, 2020

--

What is Nodejs ???

It is a platform for fast building and scalable network application built on Google Chrome JavaScript engine. It is an open source, cross platform , javascript that executes the code outside the browser.

Command line scripting and server-side scripting use basic javascript — the execution of the script for dynamic web page content generation before the user’s web page receives it.

Server-side scripting- it is a method which uses script on the web server to generate the required result customized as per client’s request to the website. Web development employes server-side scripting.

Use of node.js?

It unifies web development around a single programming language rather than different languages for server and client side scripts.

It is the perfect technology partner for the following following areas.

  1. I/O bound Applications
  2. Data Streaming Applications
  3. Data Intensive Real-time Applications (DIRT)
  4. JSON APIs based Applications
  5. Single Page Applications

Features

  • Event-driven and Asynchronous: Event-driven architecture is simply a software architecture which advertises the production, detection, consumption and reaction of an event (a significant change in the state). Asynchronous stands for the form of I/O processing which permits the other processing before the transmission has finished.Those were the formal definition of those words, what it means in simple terms is- When an API is Asynchronous then it is simply non-blocking. It also means that a server which is based on Node.js never halts for an API to return data. There is a notification mechanism of events of the approach, which helps in to get a response from the server from the previous API call when the server is busy executing the new API call
  • Very fast: It is based on V8 Javascript Engine of google chrome. Its code execution is much faster than the others.
  • Single thread Model: There are 2 concurrent requests on the servlet then creation of two separate instances would be there instead of one to process these requests.
  • No Buffering: Since the Node.js application produces output in chunks therefore there is no chance of buffering in such system.
Pic Credit: Tutorialspoint.com

A brief history:

Ryan Dahl wrote the initial node.js back in 2009 which was several years later (thirteen years to be exact) after the introduction of first server-side Javascript environment –Netscape’s LiveWire Pro Web. The initially released version only supported Linux and MAC OS X.

Dahl, The author had many complaints regarding the other existing server, since the existing had minimal possibility of handling lot of concurrent connections. Sequential code approach, the most common way of creating code in the existing approach the major problem was that in the case of simultaneous connections either there was blockage on entire process or multiple execution stack.

The new server performs a lot of processes since the time of its introduction. Let’s have a look over its progress timeline:

  • 2009 — Introduction of Node.js combined with Google’s V8 javascript engine in inaugural European JSconf.
  • 2010- npm, the introduction of package manager the publishing and sharing of source code Node.js libraries became easier. The process of installation , updating and uninstallation of libraries were now a much simpler processes to handled by the programmers
  • 2011- Implementation of windows compatible version by Microsoft and Joyent.
  • Creation of io.js took place in 2014 whose source code belonged to the existing Node.js (so io.js is a fork of node.js).
  • The node.js v0.12 and io.js v3.3 collectively makes node.js v4.0.2015 was the year of decision making for this merger.

Pros and Cons:

Node.js can perform backend programming. The benefits related to it in the role of backend source code are as follows:

  • better efficiency and overall developer productivity
  • code sharing and reuse
  • speed and performance
  • easy knowledge sharing within a team
  • a huge number of free tools

Drawbacks of Node.js

The biggest difficulty faced by it even now is its inability to process CPU bound Task and the root cause of this drawback lies in the depths of javascript.

As we know, Node.js is a runtime environment that undertakes JavaScript on the server side. A frontend programming language as JavaScript uses a single thread to execute the tasks. JavaScript is lightweight and takes up less space in CPU memory, this is the reason for not using threading running node.js.

The problem occurs when Node.js receives a CPU bound task: Whenever a heavy request comes to the event loop, Node.js would set all the CPU available to process it first, and then answer other requests queued. Slow processing and overall delay in the event loop while executing CPU task is the reason for not recommending heavy computation on node.js

Conclusion:

Every programming language, framework, Server-side programming module be it old or new has its positive and negative points. This does not mean they are useless, they may be useful to perform certain tasks which others could not. These unique abilities make a concept thrive in the industry. Node.js has certainly got a niche of survival and has a long way to go. For any information or if you have any requirement of product development in Nodejs then feel free to contact us contact@benchwork.in

--

--