With more servers going to the cloud, the way traffic is managed has changed. Load Balancing techniques have also changed.
The responsibility of a load balancer is to distribute user traffic across multiple application instances/servers to reduce the risk of failures.
Earlier, there was a need for physical load balancers to be set up and configured on the premises to manage the incoming requests. Today, the cloud providers have software-based load balancers that the cloud tenants can use to manage any surge in traffic to their infrastructure.
In this blog, we will cover all the major aspects of load balancing on the cloud. Let’s start from the beginning.
Table of Contents
What is Cloud load balancing?
Cloud load balancing takes a software-based approach to distribute workload and control traffic between cloud resources. Software-based approach to load balancing helps them in making a more optimized and scalable solution to handle volatilities in traffic.
It also allows greater flexibility in handling traffic at lower costs.
Cloud load balancing also provides other features like automatic health checks and failover mechanisms just like physical on-prem load balancers. Software-based load balancing also allows cloud providers to offer a variety of load-balancing services.
Let’s now try and understand various types of cloud load balancing. To understand that, we need to understand what is called an OSI layer.
Understanding the OSI layer
OSI or Open Systems Interconnection is a conceptual model that defines how computers can communicate with each other. It divides the communication system into 7 abstract layers. Each layer has a different protocol and method of communication.
Let’s understand the ones that are most important from a cloud load balancing perspective.
For example, the top-most layer or layer 7 is the application layer. This is where all chat application protocols and email protocols reside. This layer has the protocols that help applications present data in a meaningful format to the users of the application. It is the language application use to communicate with each other.
So, protocols like HTTP and SMTP are part of this layer.
Layer 6 is the presentation layer. This layer provides encryption, compression, and translation capability to any communication channel. All these layers take input from the below layer and send an output to the layer above.
So presentation layer transforms the data from level 5 (i.e session layer) and provides it to layer 7 (i.e. application layer).
Layer 5 is the session layer. This layer is responsible for opening and closing communication between two devices.
Layer 4 is the transport layer that is responsible for end-to-end communication between two devices. This layer breaks data into chunks to transfer them on the layers below it. It is also responsible for flow control and error control.
Protocols like TCP and UDP are part of this layer.
Layer 3 is the network layer. This layer is responsible for breaking the data chunks further into packets and reassembling them at the destination. Network layer protocols also deal with routing mechanisms i.e. finding the best path for the data to reach its destination.
Layers below 3 get into details of the physical transfer of data packets from one location to another. They are less important from a Cloud load balancing perspective. But you can read about them here.
Cloud load balancing has different types of services that work on different layers of the OSI models. The most important layers from a Cloud load balancing perspective are the application layer and the transport layer i.e. layers 7 and 4, respectively.
Types of Cloud load balancing
Let us now look at different types of Cloud load balancing offered by popular cloud providers.
Load balancing options in Azure
Microsoft Azure also offers four load balancing services.
1. Azure Traffic Manager
This provides a layer 7 DNS-based traffic load balancer. This is a useful load balancing service to be used across multiple Azure cloud regions.
2. Azure Load Balancer
It is a layer 4 network load balancer. It is useful for routing traffic between VMs and multi-tiered apps.
3. Azure Application Gateway
This layer 7 load balancer acts as a delivery controller for regional applications. It is a great option to distribute High Availability applications securely.
4. Azure Front Door
If you need layer 7 load balancing capabilities for microservices, this offering can transform multiple microservice applications into a single application delivery architecture
Load balancing options in Google Cloud
Google Cloud divides its cloud load balancing offerings in terms of protocol offerings.
The first level of classification is based on whether the load balancing across multiple regions of Google cloud or within the same region.
The second level of classification is based on the kind of load balancing the application is looking for. For example:
1. External versus internal load balancing
External load balancing helps you load balance traffic coming from outside into the cloud infrastructure. Internal load balancing helps manage traffic within Google Cloud.
2. Premium versus Standard Network Service Tiers
Premium Service Tiers provide high-performance and low-latency offerings. Standard Service tiers are lower cost. The two tiers can be mixed and matched for different resources in the cloud as per the needs of the application.
3. Proxy versus pass-through load balancing
The proxy option terminates connections from outside the cloud and creates new ones to load balance within the cloud infrastructure. Pass-through options carry the traffic right through to the compute resources
To simplify the decision-making process, Google Cloud offers a simple decision tree to choose the right load balancer for your application.
Load balancing options in AWS
AWS calls its cloud load balancing offering as Elastic Load Balancing.
AWS offers fours type of load balancing options:
1. Application Load balancing
This offering is essentially a layer 7 load balancing option to address all complex load balancing requirements at an application level.
2. Network Load balancing
This offering provides layer 4 (TCP and UDP) load balancing. This is best for applications that require low latency and needs to handle high surge while delivering high performance.
Because the load balancing happens on layer 4 of the OSI model, AWS can provide stable IP support and zonal isolations. This is useful for WebSocket-type of applications where we need long-running connections.
3. Gateway Load balancing
Gateway load balancing provides a mix of layer 3 and 4 load balancing capabilities. This load balancer option basically provides stickiness at each packet level and can transparently pass all the layer 3 traffic through inline virtual appliances.
4. Classic Load balancing
Classic load balancing can handle both layer 4 and layer 7 routing and load balancing needs.
Here is the summary of the main differences between each type of load balancing in AWS:
Other cloud load balancers
Other cloud companies like Rackspace and software companies like NGINX offer more options. You can also build a custom cloud load balancing infrastructure with these products.
Picking the right Cloud load balancer
With so many options, it is easy to feel overwhelmed and wonder which type of cloud load balancer to use. We can divide this decision-making process into three steps.
Step 1: Choosing the right cloud provider
Before choosing the load balancing services, you will need to choose the right cloud provider for your application.
Most cloud providers offer very similar load balancing options. These are added features over what type of cloud fits your application. You may have a lot of Microsoft services being used in your application. In that case, using Azure as your cloud provider might give your application added support and optimization.
So, the first step is to choose the right cloud provider.
Step 2: Choosing the type of load balancer
Next step is to choose the right type of load balancing. That is mainly driven by what your application needs.
For example, if you are trying load balance HTTP requests, then a level 7 load balancer is perfect for such use cases.
However, if you are trying to find load balancing options for mission-critical, extreme performance applications requiring low latency, you should look at layer 4 load balancing options.
Step 3: Choose as per the purpose of load balancing
Once you have decided on the layer at which you want to load balance the traffic, you will have a few options with the cloud provider. The next criterion to decide the cloud load balancing.
Here you will think of the purpose of load balancing. So, if you are load balancing within a region in the cloud, you can choose a Region-based cloud load balancing. But if you are load balancing for a globally distributed application, your load balancing choices will be skewed towards those options.
Some cloud providers like Azure even provide options to load balance microservices separately. If you are purpose is served with it, then they could be your first choice.
Taking help from Cloud providers
Each cloud provider has a help document to guide you in choosing the right cloud load balancing option. Looking at them can certainly help you pick the right ones.
Benefits of Cloud load balancing
When you move any application to the cloud, some of the common benefits include greater flexibility, reliability, and scalability. These benefits also come with a cloud-based load balancer offering.
Here are some of the biggest benefits of choosing a cloud load balancer:
Unpredictable surges can easily be handled on a cloud. Load balancing services on the cloud are optimized for the kind of surges that the application could have.
For example, a Region-based load balancer can ensure the reliability of the application is not compromised.
A cloud load balancer like Azure Front Door can ensure the critical microservices in your application are optimized for efficiency by distributing the traffic effectively. These can be extremely important for the reliability of high-performance applications.
Software-based load balancer on the cloud can easily be re-configured for newer scalability needs. There is no need to keep a large number of load balancer support professionals to handle surges.
Cloud load balancers can be configured to handle it accordingly. They can automatically pick the newer pods/servers/microservices that got created for handling traffic and distribute the traffic efficiently amongst them.
Cloud load balancing can intelligently distribute traffic among compute resources and network units. Since the cloud providers have options of both layer 7 and layer 4 load balancers, it is easy for the application developers to experiment and see which works for them better.
This flexibility makes it easy for them to choose the best option for the application.
Since cloud load balancers do not require any upfront capital investment, it is much easier for businesses to acquire load-balancing capabilities for their applications. This helps them improve operational efficiency and increase customer satisfaction levels.
There is no need for expensive load-balancing hardware, a specialized support team, and upfront capital investment for infrastructure. Cloud load-balancing is extremely cost-effective and low maintenance in that sense.
As per one claim, cloud load balancing can save you 80% of costs over hardware-based load balancing.
Irrespective of whether it is true in every situation or not, it is advisable to explore the option of cloud load balancing before you make huge investments in hardware-based load balancing.
Today, almost every cloud enterprise application uses a load balancing option from their cloud provider. The benefits of using cloud load balancing are immense, and it should be a regular point to discuss during architecture design meetings.
As the price of software-based load balancing reduces and the cost of cloud computing goes further down, this trend is only going to increase.
You may like to visit my other blogs on Cloud Computing: