First and foremost, I want to say that the title of this post Load Balancing vs High Availability is a bit of a misnomer. However I wanted to cover it because it is a topic discussed in many job interviews. If you’re interviewing for a coding job there is a good chance that your understanding of scalability will arise. Therefore you should have a solid understanding of load balancing and high availability.
In order to understand Load Balancing vs High Availability, it would help to first walk through what they each represent.
- Load balancing – Load balancing is the process of spreading a system over multiple machines. This process typically has the goal of making a system more scalable by leveraging more than a single server.
- High availability – High availability is more of a feature than a process. Essentially high availability means that if one of a system’s components goes down, it won’t bring the entire system down with it.
Load Balancing vs High Availability
As shown in this diagram, a load balancer is an actual piece of hardware that works like a traffic cop for requests. This allows the system to not force 100% of an application’s load on a single machine. For example, can you imagine what would happen if you tried to send all of Facebook’s billion + users to a single server?
The limits of a single server are quite small when it comes to the number of requests that it can simultaneously manage. Which is where load balancing comes in. A well configured load balancer can spread billions of requests across a full farm of servers. This is a process that you’ll need to become familiar with if you’re wanting to work with highly trafficked applications.
In this diagram you can see how high availability operates. Since a system being highly available is more of a description than a tool there are countless ways that you could map this out. However the key to remember when it comes to high availability is: redundancy.
A highly available system has the ability to instantly redirect requests to a backup system if a component fails. Usually this process is accomplished by the following workflow
- Server A has a cloned Server B.
- Server B is offline but constantly monitors Server A.
- As soon as Server A goes down Server B switches on and all traffic is redirected to Server B.
In this scenario, the official term for Server B is called the hot spare.
In review, there are two important distinctions between load balancing and high available systems.
- Load balancing is connected to an actual piece of hardware, namely the load balancer. Whereas being highly available can be achieved via a number of various processes, some of which can even include a load balancer.
- A system can have a load balancer and still not be highly available. If a system is configured to simply route traffic to various servers to decrease the load to any single machine, that does not mean that it’s highly available.
I hope that this has been a helpful discussion on how to answer the coding interview question regarding Load Balancing vs High Availability. And good luck with the interview!