Node.js Mantra - Why Node.js ?

Node.js Mantra - Why Node.js ?

Almost 2 decades back, we used to write simple C programs which starts from a point, runs on a single thread and terminates at the end. With the advent of programming languages like PHP, Java, .NET we totally got carried away and biased with the way these programming languages works, the idea was to abstract the programmer as much as possible from low level tasks like networking, IO, multitasking and multithreading.

Now after so many years, what was the need to reinvent the wheel, go back to some basics, patch couple of missing stuff and start all over again?

The answer is simple and is actually easy to explain to a new bee or a naive programmer. However its much difficult to digest for someone working in the industry for years, obviously due to traditional bias and shock to some design fundas learnt in so many years, its like asking him to drive a bicycle on busy lanes.

Node.js is a server side platform built on Google Chrome V8 Engine and is developed by Ryan Dahl in 2009. It runs on a single thread and uses event loop and callbacks to support concurrency. So in simple terms, we can use simplicity of a C program with advance features like concurrency management of any other programming language. However the way code is written is different from other programming language. A programmer just has to make sure that he writes non blocking code and Node.js will do the rest.

A conventional web server like Apache or IIS creates 1 thread per user request and entire request execution goes on that thread, you can simply calculate memory consumption of your user per thread, it is directly promotional to the number of users on your server. Node.js does not creates new thread for a new user request, however it uses same parent thread to send response back to the user. Therefore Node.js servers are highly scalable and blazingly fast if used correctly. Node.js servers can be a disaster if not implemented properly, a single line of blocking code will block all users on you web server.

From an enterprise point of view, Node.js provides following clear cut benefits which can not be ignored

  1. Fast Development Cycle
  2. Increased Productivity
  3. Blazing Performance
  4. Cost Savings
  5. Long term support
  6. Platform Independent

Node.js can not be used anywhere and everywhere, following are some of the areas where Node.js can be used

  1. Web Servers (Web APIs)
  2. I/O bound applications
  3. Data intensive real time applications
  4. Scheduled Jobs

Node.js should not be used in CPU intensive application where lot of complex calculations are involved which may block operations.

Enterprise using Node.js (partial list)

  1. Dow Jones
  2. Uber
  3. Godaddy
  4. PayPal
  5. Wallmart
  6. NetFlix
  7. Linkedin
  8. New York Times


Sachin Tah




Good read Sachin Tah we do see a lot of adoption but in startups. We need to see how Enterprises take it . Looking forward for the next one.

woowww... this article was cool!!!!

great article Sachin. You explained and clarified why and where Node.js can be used articulately. Many people just think Node.js is a hip term and so like to use it in their web technology dev without knowing as to why they should or shouldn't. This article clarifies quite succinctly. Request you to write a second part regarding the kind of architectures that Node.js can be best worked with. Looking forward

Like
Reply

To view or add a comment, sign in

More articles by Sachin Tah

Others also viewed

Explore content categories