What is Node.js
Node.js allows you to run JavaScript on the server. Node is an open-source runtime environment to run JavaScript on the server-side. Node is not a programming language instead it is a runtime that provides an environment for javascript developers to work at the server-side.
- Node.js is free to use.
- Multi-Platform support - Node.js runs on various platforms i.e Windows, Linux, Mac OS X, etc.
- Helps developers to run JavaScript on the Server.
- Node.js is built on Google Chrome's JavaScript V8 Engine.
- Node.js was developed by Ryan Dahl in 2009. Earlier JavaScript was only known as a client-side scripting language.
- Node.js is a cross-platform runtime environment for developing server-side and networking applications.
- Node js is best suited for real-time applications that run across distributed devices.
Node js official web site: https://nodejs.org/en/
Features of Node.js
- Node.js is Asynchronous and Event-Driven: Node.Js is Asynchronous and Event-Driven which means that if a request is received by Node for some Input/Output operation, it will execute the operation in the background and continue with processing other requests and with the callbacks it gets triggered when the task in the background is completed.
- Non Blocking I/O:
Blocking means the execution of additional javascript in node js process must wait until the IO operations are executing. Node does not block the code to execute instead it handles the IO operations in the background. - Node.js is fast:Node.js is built on Google Chrome's JavaScript V8 Engine which is considered as the fastest JavaScript Engine out there.
- Node.js is Single-Threaded:
Node js runs on a single thread only but still, it handles thousands of concurrent requests simultaneously because it executes the IO operations in the background with the event looping. - Highly Scalable:
Event mechanism using callback methods helps Node to handle many concurrent requests in a non-blocking way. - Large and Active Community:
Node.js is one of the biggest open source community which offers thousands of modules for the developers to use in their project. There are always new updates for the framework available to download and use them in your project. - Open Source: It's free to use. Node.js is an open-source framework under the MIT license.
- No Buffering:
Node.js Applications do not have any buffer data. Node applications output the data in small chunks. - Lightweight:
The Node.js framework has fewer core modules but has an active community where you can get third party packages as per the need of your application.
Who Uses Node.js?
There are many large companies that are using Node in their projects. To name a few
- Paypal
- Linked In
- eBay
- Uber
- Yahoo
- GoDaddy
When to Use Node Js
- Node.js is best for event-based Real-time applications.
- Node js uses a Non-Blocking IO model (IO- Reading files from the system it is running on, interacting with any DB server) which makes Node ideal for making web servers and application backends.
- Use Node when your tasks need more IO time(Interacting with the database, file operations, etc) but less CPU execution time.
- When your application data changes gradually and in any format.
- When your Application serves Live streaming like Youtube, Netflix, etc.
- When your application has thousands of requests concurrently.
- Chat applications.
When to not use Node Js
Never use Node for the applications where it has to perform time taking calculations, Since Node is single-threaded, all requests have to wait till the calculation finishes.
Suppose in your application, you have utilized your single node thread in some highly intensive operation, By the time it finishes user can not perform any other task.
0 Comments