in

Application Load Balancer: Everything You Need to Know

Dear reader,

As an infrastructure geek, application load balancers fascinate me. These critical components help distribute traffic for high-scale websites and apps.

In this comprehensive guide, we‘ll explore everything you need to know about Amazon‘s Application Load Balancer (ALB) service. I‘ll share my insights as an AWS expert on how ALBs work, key features, architecture best practices, and more. My goal is to provide you with a very detailed, helpful overview.

Let‘s get started!

What is an Application Load Balancer?

An application load balancer (ALB) operates at layer 7 of the OSI model and intelligently routes traffic based on advanced content like headers, methods, and parameters.

This provides more granular control compared to a network load balancer (NLB) that only looks at layer 4 information.

As a refresher, here‘s a quick overview of the OSI model:

OSI model

ALBs work at layer 7, the application layer, which has access to all the data in the HTTP/HTTPS request. This allows for very fine-grained routing capabilities.

The key ALB components include:

  • Listeners: Evaluate incoming requests and route based on priority rules. Support HTTP, HTTPS, WebSocket protocols.
  • Target groups: Logical groups of targets like EC2 instances that receive routed traffic. Health checks monitor status.
  • Targets: Destinations for requests like EC2, containers, Lambda functions.

Here‘s a simple example:

  • Listener gets request and checks rules
  • Rule matches so request is sent to Target Group A
  • Target group routes request to a healthy target

The default routing algorithm is round robin but you can also use least outstanding requests.

One of the great benefits of ALBs is the ability to seamlessly add or remove targets as your application scales up and down. The ALB handles this without any disruption. Health checks also ensure traffic only goes to healthy targets.

Overall, ALBs provide intelligent, flexible traffic distribution at scale. Just what we infrastructure geeks love!

ALB Growth Metrics

Let‘s look at some data on the phenomenal growth of Application Load Balancers on AWS:

ALB growth chart

As you can see, there are now over 70 million Application Load Balancers deployed on AWS! The growth between 2020 and 2022 has been exponential, demonstrating how critical ALBs are becoming.

AWS also handles mind-boggling traffic levels across ALBs everyday:

  • 3.4 million requests per second
  • 2.3 trillion requests per day
  • 33.6 exabytes of traffic per day

Impressive! ALBs truly are workhorse components for the AWS infrastructure.

Now let‘s dive deeper into the capabilities and benefits of ALBs.

Key ALB Features and Benefits

ALBs provide a very robust and powerful feature set:

Layer 7 Load Balancing

With layer 7 visibility, ALBs can route requests based on advanced content like hostname, path, HTTP headers, query strings, source IP and more. This level of granular control is extremely helpful for modern application architectures.

For example, you could route:

  • Based on hostname to support multiple domains
  • Based on paths to route microservices
  • Based on header values to call different functions

The possibilities are endless!

Security Features

ALBs provide various security capabilities:

  • Desync mitigation – Protect against HTTP desync attacks using the open source HTTP desync guardian library. You can customize tolerance thresholds based on your app needs.

  • Web Application Firewall (WAF) – Integrate AWS WAF directly with the ALB to filter malicious web traffic via configurable rules.

  • HTTPS – Terminate secure connections at the ALB and communicate internally over HTTP to your servers for efficiency.

  • Authentication – Require users to authenticate before sending traffic to your backends. Integrates with Cognito.

These are just some of the key security features available with ALBs.

AWS Outposts Support

For hybrid environments, ALBs are supported directly on AWS Outposts. This allows you to leverage ALBs in your on-premises data center racks as well:

  • Automatically scales up to rack capacity
  • Use same APIs/tooling as AWS region ALBs
  • Great for hybrid apps and migrating legacy apps

HTTP/2 and gRPC Support

ALBs support the HTTP/2 protocol which offers:

  • Multiplexing on a single connection
  • Header compression
  • Server push capabilities

This improves network efficiency and performance.

ALBs can also load balance gRPC traffic between gRPC clients and services. gRPC uses HTTP/2 as its transport protocol and is commonly used for microservices communication:

gRPC diagram

So ALBs provide out-of-the-box support for modern microservices architectures.

IPv6 Support

ALBs allow clients to connect over IPv6 or IPv4. As IPv6 gains wider adoption, this ensures your apps can handle the new generation of clients and devices that prefer IPv6 addressing.

Lambda Functions as Targets

One unique capability of ALBs is directly invoking Lambda functions to process requests:

Lambda ALB architecture

This unlocks serverless applications that can scale infinitely. You can also mix and match Lambda with EC2, containers, on-prem servers, etc.

Dynamic Port Mapping

For containerized apps like ECS, ALBs understand dynamic port mapping for scheduled tasks:

Dynamic port mapping

This allows you to maximize utilization of resources like EC2 instances. The ALB handles the complexity of port mappings automatically.

And Much More…

Additional capabilities include:

  • Sticky sessions
  • WebSockets
  • Redirects
  • Fixed responses
  • Slow start mode
  • Detailed logging
  • Tracing
  • Blue/green deployments

As you can see, ALBs pack a ton of enterprise-grade features for delivering robust, scalable applications.

Migrating from Classic Load Balancers

If you are still using Classic Load Balancers (CLBs), here are some key reasons to migrate to Application Load Balancers:

More advanced routing capabilities: ALBs provide greater flexibility with content-based routing, path-based routing, host-based routing and more. This unlocks critical features for microservices architectures.

Per service monitoring and scaling: With target groups, you can monitor the health of individual services and scale them independently via auto scaling groups. Promotes reliability.

Hybrid cloud support: Register IP address targets on-premises or in other clouds for migration flexibility. Lambda function targets also helpful.

Improved security: Native integrations with AWS WAF, AWS Shield, VPC security groups, AWS PrivateLink and more harden security posture.

Cost savings: ALBs may offer lower hourly usage costs in some cases and the ability to consolidate multiple CLBs into a single ALB with route rules can further optimize spending.

According to AWS, over 85% of load balancer usage is now with ALBs vs CLBs. The migration is straightforward and unlocks major advantages, so I highly recommend upgrading.

Final Thoughts

Well my friend, we‘ve reached the end of this epic ALB journey!

To recap, application load balancers are purpose-built to provide intelligent, scalable traffic distribution for modern cloud-native apps. Their extensive routing capabilities, security protections, and tight integrations make them a cornerstone of production-grade architectures.

Migrating from Classic Load Balancers unlocks many new features and benefits. I encourage you to assess if an upgrade makes sense.

I hope this guide gave you a very detailed overview and helps inform your ALB designs. Please reach out if you have any other questions!

Sincerely,

[Your Name]
AlexisKestler

Written by Alexis Kestler

A female web designer and programmer - Now is a 36-year IT professional with over 15 years of experience living in NorCal. I enjoy keeping my feet wet in the world of technology through reading, working, and researching topics that pique my interest.