Node.Js – An Indepth

Node.js is high performance server side platform running on Google V8 Javascript engine. Node.js applications are written on javascript. Node.js applications are designed to maximize throughput and efficiency, using non-blocking I/O and asynchronous events. Node.js contains a built-in asynchronous I/O library for file, socket and http communication, which allows applications to act as webserver without the need of Apache, IIS etc.

Node.js was created by Ryan Dahl in 2009. NPM a package manager for Node.js libraries was introduced in 2011.

Event driven programming is the core of Node.js applications. Event driven programming is a programming paradigm in which the flow of the program is determined by events. Its an application architecture in which main loop is divided into two sections i.e. event selection and event handling.

Node.js can keep many connections without dropping new incoming connections by using single threaded event based loop. Node.js can be extended using CommonJS module system.

Applications are executed from the command line with command: node <app name>.js

Traditionally web-serving required each request to create a new thread on webserver. In Node.js a callback is issued by operating system when a connection is made. Within in node.js runtime each connection is a small heap allocation. Node.js uses an event loop, instead of processes or threads, to scale to millions of connections happening at the same time. Node.js event loop doesn’t need to be called explicitly. Instead callbacks are defined and the server automatically enters the event loop at the end of call back definition. Node.js exits the event loop when there are no callbacks to be performed.

NPM is the package manager of Node.js. Using command line NPM registry developers can install code.

Node.js combined with various design patterns and collection data base makes an ideal open source frame work for highly scalable dynamic websites. The most popular of Javascript full stack is MEAN. MEAN stands for MongoDB(NoSQL), Express.js(Web App framework), Angular.js (MVC framework), Node.js (Server side framework).  It helps build fast, robust and maintainable production web applications.

NodeSchool is an excellent way to learn about node.js. Below is the Node.js internal architecture.

nodearch is a powerful Node module that brings the ability to simply manage long term connections with the clients.

Promises is a way to manage asynchronous control flow. A promise is an object that represents the result of an asynchronous function call. Promises are also called futures and deferreds in some communities. Promises have three states pending, fulfilled and rejected.

To monitor, troubleshoot and diagnose performance issues in your node.js applications Nodetime is quite handy. Nodetime reveals internals of your application and infrastructure through profiling and proactive monitoring enabling detailed analysis, fast troubleshooting, performance and capacity optimization. Node time metrics cover operating system state, garbage collection activity, application capacity, transactions and data base calls for supported libraries.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>