Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
What is Application Load Balancer
2.1.
Components
2.1.1.
Load Balancer
2.1.2.
Listener
2.1.3.
Target Groups
3.
Features of Application Load Balancer
3.1.
Load Balancing
3.2.
Sticky Sessions
3.3.
IPv6 Support
3.4.
Redirecting Requests
3.5.
Support of WebSockets
3.6.
IP addresses as Targets
3.7.
Content-Based Routing
3.8.
Security
3.9.
User Authentication
4.
Difference between CLB and ALB and What Are the Benefits
4.1.
Comparison between ALB and CLB
4.2.
Benefits
5.
Frequently Asked Questions
5.1.
What is an Application Load Balancer?
5.2.
What are the benefits of an Application Load Balancer?
5.3.
What is the ALB routing method?
5.4.
Can ALB do authentication?
5.5.
How many subnets does an ALB need?
6.
Conclusion
Last Updated: Mar 27, 2024

Application Load Balancer

Master Python: Predicting weather forecasts
Speaker
Ashwin Goyal
Product Manager @

Introduction

Hello, ninjas! You all must have come across the term cloud computing. Cloud computing means the delivery of IT resources over the Internet. In simple terms, you take your application online, and instead of owning and maintaining the infrastructure, you use cloud services. The associated cloud service provider takes care of the infrastructure. You control your application over the Internet without worrying about physical servers.

ALB

Now, for your application to handle incoming traffic and function smoothly, it should ensure that servers are not overloaded and the application routes the traffic accordingly. Here, the load balancer comes into play, and the application load balancer ensures the application can handle these traffic spikes. It is an essential part of any IT Team's security infrastructure. Application Load Balancer(ALB) is a feature of Elastic Load Balancing.

What is Application Load Balancer

Application Load Balancer is a load balancer on Amazon Web Services(AWS). It operates on the seventh layer(application layer) of the Open Systems Interconnection (OSI) model.

Working of ALB

The Application Load Balancer has the following functions:-

  • It distributes your application's incoming traffic across various targets in one or more availability zones. These targets include IP addresses, containers, Amazon Elastic Compute Cloud(EC2) servers, and lambda functions.
     
  • It scales the load balancing automatically since incoming traffic to the application changes from time to time. It does health checks on the registered targets to route the traffic to only healthy targets.
     
  • It assesses the application content and routes it to different applications in the AWS public cloud accordingly.
     
  • It protects your application from dangerous attacks on your application like DDoS. Thus, Application Load Balancer helps you offer fast load time in times of high incoming traffic and offers scalability, security, and availability with improved performance.

Components

Application Load Balancer has three crucial components: Load Balancer, Listener, and Target Groups.

Components of ALB

Load Balancer

It helps in splitting and routing traffic to available servers. This helps in avoiding downtime of your application and making it available.

Listener

It listens to the incoming traffic, decides to apply certain rules, and sends it to the target group accordingly. The listener makes decisions in priority order(which rule to execute first). You can also set some listener rules depending on the content of the incoming traffic.

Target Groups

It consists of many servers grouped called registered targets. After receiving a request, it sends it to one of the registered targets for the rule action.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Features of Application Load Balancer

Load Balancing

The Application Load Balancer balances the traffic to Amazon EC2 instances, containers, or lambda functions based on incoming requests.

Sticky Sessions

Application Load Balancer uses both application-based and duration-based cookies. These allow incoming requests from the same client to be routed to the same target with the help of cookies.

IPv6 Support

Application Load Balancer supports IPv6 in a virtual private cloud. Clients can connect to the ALB using IPv4 or IPv6.

Redirecting Requests

The ALB can reroute an incoming request from one URL to another.

Support of WebSockets

The ALB uses the support of WebSockets. It helps a server send real-time messages to users without requesting an update from the server. These help in two-way communication channels between a client and a server.

IP addresses as Targets

The Application Load Balancer supports the usage of IP addresses of the application backend as targets. By this, the Application Load Balancer loads the balance of any application hosted.

Content-Based Routing

If an application is made of many independent services, the ALB routes an incoming request to a service based on the information of the request. It can be Host-Based routing, Path-Based routing, HTTP method-based routing, HTTP header-based routing, etc.

Security

With the use of the AWS Web Application Firewall, your application is safeguarded against threats that may cause downtime or compromises the security of the application.

User Authentication

Whenever users try to access a web application, the ALB authenticates them through social identity providers with help of ALB's integration with Amazon Cognito. User authentication in different enterprises can also be done by connecting directly with your identity provider.

Difference between CLB and ALB and What Are the Benefits

AWS Classic Load Balancer is a traditional load balancer. Whereas AWS Application Load Balancer is the new-generation load balancer that correctly identifies the incoming traffic and routes it to the relevant resource type.

Comparison between ALB and CLB

Let us look at the table below for the key differences between ALB and CLB:

S.No.

Application Load Balancer

Classic Load Balancer

1

It operates at the seventh layer, i.e., the application layer of the OSI model.

It operates at both the fourth and seventh layers of the OSI model.

2

The protocol listeners of ALB are HTTP, gRPC, and HTTPS.

The protocol listeners of CLB are TCP, HTTP, SSL/TLS, and HTTPS.

3

The ALB allows forwarding the requests into the backend section based on the information inside the HTTP request header. 

The CLB forwards the requests without looking at the information in any of the requests to the backend section. It is a connection-based server.

4

Path-based routing is done in ALB.

Path-based routing is not done in CLB.

5

ALB has WebSocket support.

CLB does not have WebSocket support.

6

Using ALB, you can route to multiple ports on a single instance.

Using CLB, you cannot route multiple ports on a single instance.

7

The health checks on the registered targets are comparatively better.

The health checks on the registered targets are good but at a lower level than those in ALB.

Benefits

Let us look into some of the benefits of ALB:-

  • It can check the performance of servers, and hence it switches to the servers performing well, avoiding downtime.
     
  • It conducts health checks on registered targets.
     
  • It can handle sudden spikes in incoming traffic and scale accordingly.
     
  • It also provides the ability to eliminate the risk of threats like Distributed Denial-of-Service(DDoS) attacks.
     
  • It helps the packaging of microservices into containers and hosts them on EC2 servers.
     
  • It helps in redirecting one Uniform Resource Locator(URL) to another.
     
  • It encompasses the support for path and host conditions. You can configure your listener with rules which forward requests depending on the URL in the request. This allows you to break down your application into microservices and then route the requests to the relevant service based on the URL's content.
    You can configure your listener with rules which forward requests depending on the host field in the Hypertext Transfer Protocol(HTTP) header, allowing you to route requests to many domains using only one load balancer.
     
  • It helps in returning a custom HTTP response.

Frequently Asked Questions

What is an Application Load Balancer?

Application Load Balancer is a feature of Elastic Load Balancing that works on the application layer (seventh layer) of the OSI(Open Systems Interconnection) model. It allows traffic routing across multiple services or containers or EC2 instances. It provides improved performance through scalability, fast load time, and security to the application.

What are the benefits of an Application Load Balancer?

Some of the benefits of an Application Load Balancer include the ability to send routing requests to many applications on a single EC2 server, the ability to redirect requests from one URL to another, and the ability to break down an application into smaller services and route requests based on URL's content accordingly.

What is the ALB routing method?

Application Load Balancer allows route traffic based on the fields in the HTTP request header. It provides flexibility in segmenting HTTP request traffic to process each request category.

Can ALB do authentication?

Yes, Application Load Balancer can securely authenticate the users who try to access your applications. It takes off the developer's load of authentication of users, and the load balancer takes care of it.

How many subnets does an ALB need?

An Application Load Balancer needs two subnets across availability zones. These subnets are tagged accordingly to work. The controller chooses one subnet per availability zone.

Conclusion

Application Load Balancers are new-generation load balancers. These are required to offer a fast load rate, handle incoming traffic spikes, and offer the smooth performance of your application.

In this article, we first discussed what an application load balancer is. Then, we studied different components of the Application Load Balancer and its different features. Then we discussed the difference between the Classic Load Balancer and the Application Load Balancer and ALB's benefits.

So its time for you now to refer to some other articles which are based on a similar topic, i.e., Application Load Balancer:

To learn more about DSA, competitive coding, and many more knowledgeable topics, please look into the guided paths on Coding Ninjas Studio. Also, you can enroll in our courses and check out the mock test and problems available. Please check out our interview experiences and interview bundle for placement preparations.

Happy Coding!

Previous article
AWS License Manager
Next article
AWS Well-Architected Tool
Live masterclass