Basics Of Azure Load Balancer Service

The load balancer is a powerful service provided by Microsoft Azure which is usually used to balance the load between multiple backend endpoints in azure. Now a very basic question arises here that what is a load that needs to be balanced, the simple answer is that load is the traffic that is being forwarded to a particular endpoint/virtual machine to serve a request.
 
There are many scenarios when a load balancing activity is required such as below.
 
Suppose a user wants to get information about all the hospitals that have  open slots to book an appointment, then the first request goes to the server where the site is hosted and then the server serves that particular request in the form of a response of a list of hospitals. It works well in normal scenarios but in some cases or a specific time frame, there are a bulk of requests that demand a response but the server might not be able to respond quickly so we need to add additional capacity and balance the traffic load among multiple servers.
 

How to use load balancer service in Azure?

 
The creation of a load balancer service is very easy in Azure, it can be achieved with some simple clicks, but in order to work the load balancer in an optimum way, we need to configure some additional components.
 
Frontend IP
 
It is a public IP that is exposed to the public internet or users and all users from the public network communicate with the FronendIP only, they cannot communicate directly to VM to get the response.
 
Backend Pool
 
All virtual machines are configured in the backend pool as back service and requests go to respective virtual machines according to the load balancing rule configured in the load balancer to serve a request.
 
Health Probe
 
This configuration is required by the load balancer whether all the virtual machines configured in the backend pool are active or not. If a virtual machine is not active/not online, then the load balancer needs to know about this outage to stop forwarding the traffic to the inactive virtual machine. It usually sends a heartbeat with the configured time frame in the load balancer to know the status of the virtual machine.
 
Load Balancing rules
 
These are the rules/algorithms that are configured in the load balancer which help to forward the traffic to a particular virtual machine to serve in the backend pool. It identifies which port number the virtual machine listening for e.g. if a virtual machine in the backend pool in listening on port 80 and a request comes from port 80 then the rule is matched, and traffic will be forwarded to the correct VM.
 

Types of SKU?

 
There are two types of SKU available while setting up a load balancer that can be used in different situations according to requirement.
 
Basic load balancer
 
It can be used when you have a single virtual machine in your network and that is single/multiple virtual machines are part of your availability set.
 
Standard Load balancer
 
It is used in most of the common situations when multiple virtual machines are part of your network and you need to balance the load across all of them. These VMs may be part of the availability set as well. Microsoft recommends using standard SKU as it has more features.
 

Types of Load Balancers?

 
Basically, there are two types of load balancers.
 
Internal load balancer
 
As the name suggests, this can be used internally inside your network and behind one set of VMs.
 
External load balancer
 
This is used in front of public internet and forwards the traffic to the correct virtual machine according to the rule.
 
We can understand this more in detail with the help of the below architecture diagram.
 
Basics of Azure Load Balancer Service
 
Note
In this architecture communication with the virtual machines does not happen through the Public IP of virtual machines rather it happens via a Private IP address. only one public IP will be configured as FronendIP with an external load balancer.
 

Conclusion

 
In this article, we have covered the basics of load balancer service and discussed the important aspects of it. Configuration of all the services is easy in azure and can be achieved as per the diagram.