top of page

Elastic Load Balancer & Mr. Loba

Updated: Jul 31, 2020

In this article, we will discuss about Amazon Elastic Load balancer, how it works, its types and benefits in a lay-person's perspective.

Before we move into the article, I would like to set your mind on a specific analogy. Lets imagine a 5-Star Hotel Kitchen. The hotel gets many guests for Breakfast, lunch & Dinner. Sometimes, there could be some spike in the number of guests and still they would need to cater them quickly.

I like eating various cuisines in hotels and so I took this analogy though there are many others that we could relate to.

To easily travel into this analogy, lets assume the following;

  • Internet Traffic - Hotel Dine-in guests

  • Elastic Load Balancer - Chef Mr. Loba (Abbreviated Load Balancer to Loba)

  • Targets - Cooks

  • Target Group - Group of cooks (Say Italian, Arabian, Chinese & Indian)

  • Availability Zones - Different Kitchen wings of Hotel

This hotel follows the same process as every other.

  1. Guests go through the Menu card and order their food to the waiter.

  2. The order goes to the chef (Mr. Loba).

  3. Mr. Loba looks into the order routes the order to one or more cooks.

Now lets look at each concept of Amazon Elastic Load Balancer with this analogy.


What is an Elastic Load Balancer?

In AWS: Amazon load balancer is a highly available and scalable load balancing service provided by Amazon. This distributes the application or network traffic to the target resources. Here the targets could be EC2 instances, IP addresses or Docker containers. In this diagram, the component within Subnet 1 (SN1) is the load balancer. The targets shown here are EC2 instances and Docker container for understanding purpose only.

In Hotel: In this hotel example, our chef Mr. Loba can be compared with Elastic Load Balancer. This is because he gets the orders from customers on various cuisines and he would need to serve the requests efficiently. There could be scenarios where he would need to change the way he sends the requests to cooks. We will discuss that in the load balancer types.


How an Elastic Load Balancer works?

In AWS: Internet users across the world browse internet to visit a particular website. If the website is managed by AWS, the traffic is routed to Amazon Load balancer after Route 53 responds to requests with the IP address. In this case, the IP address of the load balancer is provided. When the load balancer gets the traffic, it distributes the traffic to various targets. The targets shown in this diagram (EC2 instances and Docker container) are just for illustration purpose.

In Hotel: Mr. Loba gets the orders from guests (through waiter) and he allocates the request to appropriate cooks to quickly prepare & serve the food. He may get orders from the menu provided or customized order from some guests and the same will need to be fulfilled. Sometimes (say during weekends) there could be a spike in the number of guests dining in and the chef would need to manage the increased requests efficiently.


What are the types of Elastic Load Balancers?

There are three types of Elastic Load Balancers in AWS.

  1. Classic Load Balancer

  2. Application Load Balancer

  3. Network Load Balancer

What are the components of Load Balancers?

  1. Load Balancer - Single point of contact for traffic. Routes traffic to target groups or targets.

  2. Listener - Checks for the requests from clients using protocol & port. Routing is based on the listener rules and priority.

  3. Target Group: Group of targets like EC2 instances or Docker containers etc., registered in a target group. One target can be registered with multiple target groups.


Classic Load Balancer:

  • These are basic type of Elastic Load Balancers.

  • Operates at layer 4 of the Open Systems Interconnection (OSI) model.

  • Routing based on IP Address and TCP port.

  • Routing is performed directly to targets (EC2).

  • Can route to one or more availability zones.

  • Performs health check before routing to targets.

  • Can add or remove targets as and when needed.

  • Supports sticky sessions.

  • Can do Cross zone load balancing, if enabled.

Mr. Loba in Classic scenario:

  • This is a case of fulfilling a standard menu item as part of the order.

  • Mr. Loba directly routes the order to a cook and gets the order fulfilled. In this diagram, you could see Mr. Loba directly routing the order to cook 1.

  • Mr. Loba performs a quick check if the cook is ready and available to prepare the order, before routing the order.

  • Sometimes he may route the order to other wing if there is anything wrong (like burner not working etc) with cook 1.

  • If there is increase in the number of orders, he may start routing the requests to cook 2 as well to evenly distribute the orders.


Application Load Balancer:

  • Operates at Application layer (the seventh layer of the Open Systems Interconnection (OSI) model).

  • Ability to evaluate application level content apart from IP and port.

  • Evaluates listener rules in priority order before routing to target groups.

  • Routing and its algorithm is performed independently on each target group.

  • Default algorithm is round robin.

  • Path-based routing supported.

  • Supports sticky sessions.

  • Scales automatically

  • Can route to multiple target groups

  • Configure health checks of the target group so that all targets in that group are checked.

Mr. Loba in ALB scenario:

  • Lets assume that we have a big group of customers arrived to dine in. They all decide to have Chinese food and place their order.

  • They also specify their customization (what they want and what they do not want) while placing the order.

  • Chef Mr. Loba gets the order from waiter for Chinese food.

  • Now Chef Mr. Loba sends the request to the "Chinese cooks" Target Group rather than sending to individual cooks.

  • A target group may have a mixture of cooks from all cuisines as well.

  • He also checks that all cooks within the target group are available and ready to pick the order.

  • Sometimes, the chef may route the orders to multiple target groups as well.

  • In this illustration you can notice Mr. Loba routing the request directly to the group.


Network Load Balancer:

  • Operates at Network & Transport layers (the fourth layer of the Open Systems Interconnection (OSI) model).

  • The best type of elastic load balancer.

  • This is a TCP load balancer and can handle millions of requests per second.

  • Can handle heavy and volatile traffic efficiently.

  • Distributes traffic based on IP addresses and destination ports.

  • Does not evaluate contents of application layer but just route the requests to target groups.

  • Scales automatically

  • Cannot assure availability of application as it operates at network level.

  • Configure health checks of the target group so that all targets in that group are checked.

Mr. Loba in NLB scenario:

  • Lets assume there is a mad rush of customers on a weekend and customers are flocking in for dining.

  • Customers make a bulk order of some cuisines that are available in the menu.

  • Now this time, Mr. Loba does not look into the customization part as it is a bulk order and concentrates on handling the requests quickly.

  • Chef Mr. Loba gets the order from waiter continuously.

  • Now Chef Mr. Loba sends the request to the Target Groups continuously.

  • He also checks that all cooks are fine and available to do the order before routing.


Benefits of Load Balancers:


Better to know: 7 Layers of OSI Model (Starts from bottom up)


I hope this might have given a high level view of what Elastic load balancer is and how it works from lay-person's perspective. However, this article is just for a high level understanding or summarized view of Elastic Load Balancers and does not cover everything in detail.

Kindly go through the concepts, use cases and features in detail from Amazon documentation.

Please like the post and provide your valuable comments below here on this article, if it has helped you a bit.

995 views3 comments
bottom of page