a blog for those who code

Friday 11 September 2015

Load Balancers for NodeJS Applications

In this post we are going to dicuss about the ways of doing Load Balancing in NodeJS. Load Balancing is needed in order to distribute the load of work across multiple resources (a.k.a. server).


Load balancing is needed in our application to control the user requests coming to a server. Load balancing usually involves dedicated software or hardware such as multilayer switch or a Domain Name System server process.

Way 1 : Cluster

Cluster is a native module of NodeJS which takes advantage of multi-core systems to handle the load. Cluster module in Node.js allows you to run seperate processes which will share same server port. It allows you to create child processes that all share server ports.


Way 2 : HAProxy

HAProxy (High Availability Proxy) is an open source proxy server. According to HAProxy, it is free, very fast and reliable solution offering high availability, load balancing and proying for TCP and HTTP-based applicatios. It is particularly suited for high traffic web sites.


Way 3 : Nginx

Nginx is a free,open source, high-performance HTTP server and reverse proxy, similar to Apache but much faster. Nginx is known for its high performance, stability, rich feature set, simple configuration and low resource consumption.


Way 4 : Varnish

Varnish is a caching proxy meaning it handles all of the requests when it can handle. Varnish cache is a web application accelerator also known as a cahing HTTP reverse proxy. You can install it in front of any server that speaks HTTP and configure it to cache the contents.


We can set up all the above load balancer in our NodeJS application. In our next posts we will be showing how to set up each load balancer in Node our application.

Please Like and Share CodingDefined.com Blog, if you find it interesting and helpful.

No comments:

Post a Comment