Introduction to NodeJS
Node.js is a free and open-source server environment. Node.js is very popular in recent times and a large number of companies like Microsoft, Paypal, Uber, Yahoo, General Electric and many others are using Node.js.
Key features
- Built on
Google chrome's javascript engine V8
and is pretty fast. - Node.js was developed by Ryan Dahl in 2009.
- Server-side platform for building fast and scalable applications.
- Node.js is
Asynchronous
,event-driven
and works onsingle-thread model
thus eliminating the dis-advantages of multi-thread model. - Supports various platforms like Windows, Linux, MacOS etc.
- Provides rich library of java script modules which simplifies the development efforts.
- Released under MIT license.
Limitations of Multi-thread paradigm
- Each request is handled by a seperate thread. If there are millions of requests, millions of threads are created, which is difficult to handle or it's very costly to accomodate millions of requests.
- Lock on shared resources, other threads have to wait until a thread using the shared resource gets complete and hence it's very time consuming.
Advantages of Node.js
Below are the few notable advantages of NodeJS.
- Highly scalable
- High performance as it is built on Google chrome's V8.
- easy to learn and only because of NodeJS, JS is referred as Full-stack JS as both server and client side can be written in JS itself. Thus saves a lot of time and money.
- Asynchronous.
Where Node.js is not advisable
Node.js is not advisable for CPU intensive applications.