Now a days, whenever performance oriented web server debate are done then one name emerges out of other web server framework, that is Node.Js. So, in our mind question occurs that, why Node.Js and not JavaEE or .Net framework or any other. I have tried to identify about this question.
My First question is “WHAT IS Node.JS?”
It is a JavaScript run-time environment, developed on Google V8 JavaScript engine. It was originally written by Ryan Dahl in 2009. It is Open source Cross – Platform programming environment. Normally when we hear about JavaScript, ”Client-side” development embedded in web pages comes in our mind. Node.Js is an open-source, Cross-platform JavaScript runtime, which provide server side scripting. We can also call it “Node” only. Node is normally considered for server side web solution to handle request and response. It also provides good solution for networking. It empower developer to use JavaScript everywhere instead of just in browser, the behavior of Node is non-blocking means command can run parallel, can call back to signals completed or filer. That means it’s an asynchronous, non-blocking, event driven I/O System. It have built in support of HTTP, DNS, TLS and it also never forces the buffering of data. Ultimately, Node is a runtime system that makes it easy to build server-side, network or other event-driven application.
My Next question is “WHAT IS USE OF Node.JS?”
Node.js best uses is, when you require “long-pulling”. Long pulling means a persistent connection between server and browser, like send updates to client from server in real time. Currently Ruby on Rail or Django allow to create such applications, but such applications also use tremendous amount of RAM and CPU, because it has one process each for active client. But, Node does not require to maintain separate thread for such requirements. So, we can say that from evolution of state-less web based request – response model, now we have web application with real-time, two way connection where client and server can communicate and exchange data freely. So, ultimately following are the crucks of above understanding.
1. For RTAs: RTAs means Real – time applications. If Applications require high volume of short messages with low latency, then Node.js is the good choice. This applications are drawing/ editing – type apps, where user can watch live modification of data. Such RTAs application list with Node.js are very long.
2. Less CPU, memory foot print and more data travel: CPU hungry application have very bad effect on execution of Node. In opposite to this the application which use less CPU and data are moving between one places to other, or say data handshaking are more. Applications like live-chat, instant-messaging and e-commerce transactions.
3. Socket programing: When user need application that communicates with socket then Node is the best choice out of the other languages because of JavaScript, as at server side and client side programmer need to play with JavaScript only. Application like controlling machine and IoT, Video conferencing over VoIP, online gaming and finally RDC kind functionality.
4. Apart from above: So many modules are available which are developed on Node and you can download it with help of “npm”. With help of those modules user can design cross-platform application based on node-webkit, PDFKit lets you generate PDFs using an “HTML5 canvas-like API”, manages communication between mobile and your PC.
5. And finally: Based on Node.Js an operating system is announced which is called NodeOS.
Now let see the pros & cons for using Node.Js
First Pros:
1. JavaScript, easy to learn and single programming language at server and client
2. JavaScript and V8 engine are deadly combination which provide speed and delivers improved performance
3. Easy to scale with more module and resources
4. Asynchronous I/O and event handling model which helps to handle concurrent request
5. Code sharing and reuse with help of “npm”, user can find tons of free model there which are still growing
6. It’s help to develop RTA applications
7. Can stream big files
8. Has active and dynamic community, with lots of code sharing. It’s also supporting commonly used tools
Now Cons:
1. Not suitable for CPU hungry and complex web applications
2. Lack of scalability. Not able to take advantage of multi core hardware, as supports only single threaded application
3. It does not support RDBMS
4. Design issue with callback methodology, as possibility of multiple nested callback
5. Lack of common powerful libraries and developer finds difficulties to accomplish their common programming task
6. As Node is open source platform of development; API is unstable and changes frequently. New API may not support backward compatibility
7. It’s difficult to understand the Asynchronous model and it is complicated compared to blocking I/O programming
The Final Conclusion:
Node is a framework with core of JavaScript as language and V8 engine as backbone. If user knows only JavaScript as programming language instead of any other language, user can develop app with Node. As we know that, Node is emerging framework and still evolving and many things need to be achieved. Many programmers find it in immature stage and difficult to program. Apart of this, we need to consider that frameworks are design to do one or more things. Programmer has to decide what needs to be used against compromise. When need to develop the apps like gaming, networking, social media and live chat then Node is one of the good candidates against other frameworks. When we talk about fast and scalable IoT device apps Node comes first in our mind. Due to non-blocking behavior Node can perform much better for encoding and broadcasting video and audio, data streaming and uploading multi file. In general, Node can be used with apps which using less CPU and have high I/O bound operations. Node has a great community support named “npm” with huge library of free modules. Big name are associated with it like Capital One, NASA, Paypal, Uber, LinkedIn and many more in list. Now, user can’t decide to use language or tools just because super-successful company did. They need to take a tour of framework’s pros and cons and decide to use it as it is the best. But, let me tell that in mobile development and mobile gaming Node is unbeatable and future era is dedicated to Node.
External ref.
Beyond the Web: 10 surprising Node.js projects
15 Best Node.js Tools for Developers
Seven Awesome Things You Can Build with Node.js
9 Famous Apps Built with Node.js