Friday 23 August 2013

Software Vs Hardware Load Balancer ?


Load balancing your application is crucial piece of your whole architecture. Load balancer plays an important role to maintain application & network performance; it helps in dynamic load balancing which is very important for ensuring that our requests and resources are evenly distributed across available servers and in an optimal manner.

The basic question which haunts us frequently is ...........How to decide that we should use hardware load balancer or software load balancer and on what criteria the decision should be taken?

This question in itself is very complicated and the answer would differ from person to person and upon requirement. There is no end to any technical argument if you don't have any data to validate about what you are suggesting / interpreting ;). So, whatever I will be proposing in this blog is my personal view and I leave it up to you to agree/disagree.

We should be cognizant about our exact requirement (never do over engineering) and henceforth use your technical skills and experience in appropriate direction to get the utmost out of it. If you are a novice to Load balancer and its use/implementation then hopefully this would be a good place to kick start. You can drop me a mail if you have any doubts regarding below explanation, will try my best to clarify your doubts.

Now coming back to original question………….How to make a decision on whether we should go ahead with HLB or SLB (Hardware Load Balancer or Software Load Balancer)? 

The obvious difference is that one is software and so needs to be installed on a server. That server can be of any configuration and therefore could be fast or slow, reliable or not etc etc (Totally depends on server configuration such has Ram size, CPU cores etc etc…Google it  know more). A hardware load balancer is a dedicated piece of hardware that you would install in your server rack.

The question comes down to your budget, experience and the importance of your product. If you have the money to spend, dedicated load balancers are the easy and safe way to go. But in a pinch, a dedicated server running load balancing software should be fine if you're able to configure it (depending on the hardware and traffic demands). Some of the things which should be kept in mind before taking any decision is mentioned below:
 
  1. Concurrent requests on your site.
  2. HA is required for your site or not (HA -> High availability)
  3. Performance/speed (HLB definitely enhance the performance of the site in many ways)
  4. Costs
  5. Downtime (Can you afford this?)
  6. In-house skill sets to setup and troubleshoot issues if you are setting up SLB yourself.
  7. Scalability (The most important parameter, IMO)

To terminate SSL most of the companies run SSL connections into Linux boxes running Apache. This setup is convenient and easy to setup but it's not optimized for SSL, so it's slow and costly operation. Much of the capacities of these servers are unnecessarily consumed processing SSL. Load balancers on the other hand have crypto cards that terminate SSL very efficiently in hardware. Getting rid of the Linux boxes and moving SSL to HLB will decrease load on Apache and eventually lower the number of request being processed by Apache which would eventually enhance Apache performance and a whole lot of CPU can easily be reclaimed. Client performance will also be greatly increased because SSL accelerators are faster at SSL than generic LINUX boxes. Though you can argue that Nginx can be used for the SSL and rest of the operations could be left with Apache, but again Nginx needs a dedicated Linux box to be set up.

SLB is a single point of failure. We can use Haproxy in front of apache. Haproxy and Apache both can act as SLB but Haproxy is more robust than Apache and is a reliable, High performance TCP/HTTP Load Balancer. It will not make you let you down. And the most important thing is it's open source or to be more specific it's FREE!!!!!FREE!!!!!FREE!!!!!!!.........And you know FREE is always better and give eternal happiness to us :) . Moreover you don't have to depend on 3rd Party for making any changes at LB level. Generally LB are maintained by third party or sysadmin and you will have limited or no access to it. So better go for Haproxy as Load balancer and Nginx for the serving https requests.

But as you organization grows bigger and bigger than you have to go for some robust and scalable architecture. Scalability is the biggest factor for any growing organization.HLB are dedicated LB and they were meant for some purpose and not merely for earning money by big fish like Cisco. A normal person can't even think to buy Cisco/F5/F20 load balancer because they are so costly. Definitely there are open source LB available but it doesn't solve your purpose solely ..........To explain in simple words ......You can cook doesn't mean you are a chef ;).So definitely hardware has its own 1001 advantages but you should know when to go for it ;until and unless you have enough money in pocket to shed off ;) . To be very practical, here the debate isn't really on "HLB" vs "SLB". It is on "buy a proven/tested/certified technology stack as an appliance” versus “builds it yourself using open source". 

I had tried my best not be biased and had given an overview about SLB as well as HLB. Now, the call is completely yours. 

My personal point of view:

Having a bit of knowledge about performance engineering (I am aware that HLB will definitely boost performance of application ;) ) ,being a bit of developer, a bit knowledge of Sysadmin , a bit knowledge of supporting & troubleshooting production issues, and doing production deployment frequently .......I would give my vote to Software Load Balancer. It’s a onetime pain to establish everything initially but once set up fully you would be the undisputed owner of it and can play around with it. Things are always easy if you are controlling it. Believe me, telling my personal experience, it's a pain in a** to go to sysadmin and request changes at LB level. These devices (HLB) are out of your control and are difficult to debug, provision, and test. So my vote goes to Software Load Balancer (SLB) and to be more specific HAProxy.

Had tried to cover up on how to use Apache as Software Load Balancer (using mod_jk configuration). Check this out: http://kulshresht-gautam.blogspot.in/2013/08/how-to-use-apache-as-software-load.html


Abbreviation used in this Blog : 

Load Balancer: LB
Hardware Load Balancer: HLB
Software Load Balancer : SLB

1 comment: