Thursday, January 15, 2015

Amazing Features of Node.js





Node.js is an Server side scripting, open source, cross-platform built on Google Chrome V8 JavaScript runtime environment for easily building fast server-side and   scalable networking applications.
Its multiple advantages over other server side languages, Node.js inbuilt with a dependable package management system called NPM and its registry npmjs.org which is easily built and publish software and libary as packages.




Node.js is functionally similar to the PHP + Apache or ASP + IIS stacks,and its applications works as an non-blocking I/O model,event-driven which are scripted in javascript and debugs within the Node.js runtime on Linux, Microsoft WIndows ,OS-X and Free BSD.
There are no classes in Node.js/JavaScript, because its objects inherit directly from other objects (prototypal inheritance). Node.js has natural with NoSQL databases like MongoDB, NoSQL databases are mostly use for cloud computing, agile projects and prototyping which are very secure and easily recoverable.


Syntax
The syntax of node.js is the set of rules that define a correctly structured JavaScript program. JavaScript is mainly used for client-side scripting within modern web browsers.
Context switch
Node.js switch between different environments and languages is attributed to the drop of efficiency when writing software code.
Node.js is contains less context switches.


Modules
Node.js comes with a superior and dependable package management system called NPM and its registry npmjs.org and administered via the package.json file and version locally, unless lib installed with the -g option. Both PHP and Node.js are functional languages with a relatively later addition of OOP to PHP.


Ecosystem
Node.js is growing faster than any other platform/language. This is mostly due to minimal modules and performing only a small set and sub-sets of tasks. Other factors might include such things as:
  • Existence of the specs, and abundance of JavaScript resources and gurus (such as Doug Crockford) amassed during the language’s many years of existence
  • Ease of NPM use, e.g., to publish an NPM module run $ npm publish
  • NPM is a default for Node.js and package manager for JavaScript.


Frameworks
Node.js works on collection of web frameworks few of them are Meteor,Express,Socket.io,Sails,Mean,Koa,Socketstream,Spine,Tower,Total.js, Flatiron, Express.io, Locomotive.Bone.io, Frisby,Stapes,Turtle.io, Sleek.js and some of most popular build systems for web are also available which made development with ease grunt, bower, yeoman and another futur player glup.js,


Real-time apps
Real-time apps building is just a breeze with Node.js stack of the Socket.io , Express.js frameworks. another full stack players are Derby projects, Meteor, which makes real-time apps building is taken one step further by combining front and back-end code bases with the persistence layer which reduces the complexity and speeds up the development dramatically. event driven programming in node js making web development to another level.


Database apps
Node.js is natural with NoSQL databases like MongoDB.
The databases’ performances are comparable to each other and  depending on the use cases as per MySql vs MongoDB performance benchmark(MySQL), Simple Test : MongoDB vs MySQL(MongoDB) and MongoDb vs MySql – However, MongoDB is superior and highly scalable for distributed databases and means.io has ready to use package of mango, express, angular, socket.io .NoSQL databases are secure and perfect for cloud computing, prototyping and agile projects.


Third-party services apps
Due to a  effect of non-blocking I/O, Node.js manage to handle multiple requests and make multiple requests as a client to a third-party services.
(e.g., Twitter, Amazon) with just one thread of execution.


Web servers
Node.js was created from the ground up for the network applications and there is a set of core modules to write web servers.
To start a Node.js server: $ node .
Note: In Node.js Multi-threading is absolutely possible with clusters and/or external modules.


Hosting
Node.js works nicely on PaaSs, with Heroku, Nodejitsu, Appfog, nodejitsu leading the list and also the cloud infrastructure company Joyent that developed powerful operation system SmartOS that allows for painless deployment ,performance bursts and DTrace debugging.


Performance Matrix
Node.js is extremely fast due to its non-blocking I/O mechanism and Google Chrome V8 engine technology.


Node.js is platform for building applications. not a web application framework. It's a It includes a set of tools useful in building web applications (such as modules for writing to the filesystem or making HTTP requests).


Some Important points and advantages of Node.js
Use of node.js
Node.js can be used for the following purposes
a)      Web applications ( especially real-time web apps )
b)      Network applications
c)       Distributed systems
d)      General purpose applications


The advantage of using node.js
a)    It provides an easy platform to build scalable networking programs
b)    Generally fast
c)    Great concurrency
d)    Asynchronous everything
e)    Almost never blocks


The Two types of API functions in Node.js
a)      Asynchronous, non-blocking functions
b)      Synchronous, blocking functions


Control flow function in Node.js
A generic piece of code which debugs/run in between several asynchronous functions calls is control flow function.


“Control Flow” controls the functions calls in Node.js
a)      Control the order of execution
b)      Collect data
c)      Limit concurrency
d)      Call the next step in program


Node.js is single threaded
For async processing, Node.js was created explicitly for more performance and scalability can be achieved by doing async processing on a single thread .


Async in Node.js
By following steps you can async Node.js
a)      First class functions
b)      Function composition
c)       Callback Counters
d)      Event loops


“Non-blocking” in node.js
In node.js “non-blocking” means that its IO is non-blocking.  Node uses “libuv” to handle its IO in a platform-agnostic way, it queues it within the event loop which call the JavaScript ‘callback’ on the main JavaScript thread.


Challenges with Node.js
Emphasizing on the technical point of view, it’s a bit of challenge in Node.js runs one process with only one thread to scale up on multi core server.


No comments:

Post a Comment