Thursday, 24 January 2013

Node.js: Server-side JavaScript Technology


Rising from non-existence three short years ago, Node.js is already attracting the accolades and disdain enjoyed and endured by the Ruby and Rails community just a short time ago. It overtook Rails as the most popular Github repository last November and was selected by InfoWorld for the Technology of the Year Award in 2012.

Node.js is a server side software system designed for writing scalable Internet applications, notably web servers.Programs are written on the server side in JavaScript, using event-driven, asynchronous I/O to minimize overhead and maximize scalability.

Node.js is a packaged compilation of Google's V8 JavaScript engine, the libUV platform abstraction layer, and a core library, which is itself primarily written in JavaScript.

Node.js was created by Ryan Dahl starting in 2009, and its growth is sponsored by Joyent, his former employer.

Dahl's original goal was to create web sites with push capabilities as seen in web applications like Gmail. After trying solutions in several other programming languages he chose JavaScript because of the lack of an existing I/O API. This allowed him to define a convention of non-blocking, event-driven I/O.

Similar environments written in other programming languages include Twisted for Python, Perl Object Environment for Perl, libevent for C, Vert.x for Java and EventMachine for Ruby. Unlike most JavaScript programs, it is not executed in a web browser, but instead as a server-side JavaScript application. Node.js implements some CommonJS specifications. It provides a REPL environment for interactive testing.

If you are a technology explorer like me then I am sure you have heard about Node.Js. This young server side technology is around internet for quite some time now, almost 3 years wow… and I am like following it from its Year One and kind of falling in love with it.

With any new technology come new syntax, new set of rules and so on, some are easy to learn and some are like a strangers whom you never want to meet again.  But creator of NodeJS was thinking exactly the same while designing this technology, why do we need all new stuff and can’t we use some existing stuff and make it more powerful and they thought of bring JavaScript to server. Their are lot of JavaScript based server side engines now like Mozilla Rhino, JSF and JSF based IBM XPages they can also do that too, but this one is actually different… keep reading.

What is Node.js?

Node.Js is a technology designed to develop scalable Internet application notably web servers.  The developer using JavaScript technology to write this application, using event-driven, asynchronous I/O to minimize overhead and maximize scalability. Node.js consists of Google’s V8 JavaScript engine, libUV, and several built-in libraries.

Who is behind this project?

It is designed and developed by Ryan Dahl who made this project open source, now 100 of developer around the web supporting and contributing this project. Currently this project is funded by Joyent a Cloud computing company who is also employer of Ryan Dahl. This project has got tremendous support and specially from Microsoft who is also the sponsor for Node.js. Microsoft is not just sponsor they have helped team to port the node.js platform on Windows OS and not just that Node.js is also one of technology supported by Microsoft’s Windows Azure cloud platform.

(early it was only supported on Linux and Mac which was a pain to install)

How does this work?

Like I said Node,js is a event-driven JavaScript based technology which runs on googles C,C++ based javascript engine V8, which happen to be one of the best java-script engine till date.

Node.js is best known for fast and effective client – server communication, unlike other technology node.js does not uses threads for I/O operations.

If you are using technology (for Example: Java / .Net )  they uses tread for I/O operations when a client makes a server call and a new process is initiated on the server everytime,  these processes has to wait for another process to complete its I/O operations which is internally managed by CPU with the help of treads.  Node.js solves this problem, it can run on single process and makes the I/O calls with the asynchronous callback method of javasciprt,( like an AJAX call made by client application).

I/O would execute the process and sets the callback and proceed with other request, it would make the callback function call whenever process completes the operation which inturn handles by CPU. Client doesn’t have to wait for a servers response, rather in this case server would contact all its clients when it has completed this I/O operations.

This is proven to be most efficient method so far, their is a graph which shows that if your are running a node.js server a single process can handle approximately 10,000 client requests/sec, where as an Apache server with same configuration can handle 3000 requests/sec which eventually goes down( multiple process no doubt, it runs Java…)

Its not just that Google V8 engine has also added a hell lot of power into this technology it also allow you to extend node js if you know C/C++ and create your own modules and library. This makes it as power full as any other web technology available in market.
Who are using Node.js?

Node.js is best combined with HTML5 and can handel server socket communication. This is going to be next big thing in your online communication and chat engines.

Node.js is very well adapted by Web and internet based multi-player games on facebook and other popular platform and even normal web based games like angry birds.

Not just cames in coming days their are going to be lots of mobile OS in making which are going to be running HTML5 based internet application as their local apps starting from Boot to Geko, webOS to new Linux project Tizen. Major chunck of this apps are going to be dependable on node.js … ( why u think Microsoft is supporting it  )

Node is still evolving and making it self stronger day by day. TechGearz is going to have a series of article on how to develop application using Node.js and what are the different tools which is going help us doing this.. so keep reading.

How to do Node 
Download node.js

 Node.js Explained 

This presentation explains the basic theory and programming model central to Node's approach and will help you understand the resulting benefits and challenges it presents.


.

No comments:

Post a Comment