Definition

Application Load Balancer

What is Application Load Balancer?

The Application Load Balancer is a feature of Elastic Load Balancing that allows a developer to configure and route incoming end-user traffic to applications based in the AWS public cloud.

In a cloud environment with multiple web services, load balancing is essential. By distributing network traffic and information flows across multiple servers, a load balancer ensures no single server bears too much demand. This improves application responsiveness and availability, enhances user experiences, and can protect from distributed denial-of-service (DDoS) attacks.

Inside the AWS cloud, Elastic Load Balancing (ELB) is a critical architecture component for many applications and web services. Launched in 2009, ELB automatically distributes incoming traffic across Amazon EC2 (Elastic Compute Cloud) instances, containers, IP addresses, etc. This makes it easier to build highly available applications that autoscale up or down for a vast majority of workloads and for evolving business needs.

ELB in AWS supports several load balancers, including the Application Load Balancer, which functions at the application layer, the seventh layer (HTTP) of the Open Systems Interconnection (OSI) model.

OSI model
Application Load Balancer works in Layer 7 of the OSI reference model for how applications communicate over a network.

How does the Application Load Balancer work?

In recent years, access to web applications has exponentially increased. However, sudden spikes in traffic can cause web services to slow down, affecting availability. The Application Load Balancer effectively distributes network load in the public cloud to improve both stability and availability.

If a faulty application reaches Layer 7, the Application Load Balancer will route traffic only to a healthy target within the cloud resource. Application Load Balancer also supports WebSocket for more communication with the underlying server.

Application Load Balancer inspects packets and creates access points to HTTP and HTTPS headers. It identifies the type of load and spreads it out to the target with higher efficiency based on application traffic flowing in HTTP messages. Application Load Balancer also conducts health checks on connected services on a per-port basis to evaluate a range of possible code and HTTP errors. A developer receives detailed metrics following the checks.

Application Load Balancer is particularly useful for websites and mobile apps running in containers or on AWS EC2 instances. Within a microservices architecture, Application Load Balancer can be used as an internal load balancer in front of EC2 instances or Docker containers implementing a particular service. It can also be used in front of an application implementing a RESTful API.

The Application Load Balancer works with many AWS services, including:

load balancing
Application Load Balancer is one of several load balancers supported by Elastic Load Balancing in AWS.

Application Load Balancer overview and features

The original Elastic Load Balancer in AWS, also known as the Classic Load Balancer, is still available. It works at both Layer 4 (TCP) and Layer 7 (HTTP). However, the Classic Load Balancer has quite a few limitations. For example, it cannot forward traffic on more than one port per instance. It also doesn't support forwarding to IP addresses or WebSocket.

Application Load Balancer eliminates these shortcomings. It can forward traffic to IP addresses, so it can have targets outside the AWS cloud. Also, the Application Load Balancer can route requests to many ports on a single target, or to AWS Lambda functions. Moreover, unlike the original load balancer in ECB, which can serve only one domain name, Application Load Balancer supports Server Name Indication (SNI), allowing it to serve multiple domain names.

Furthermore, the Application Load Balancer provides native support for HTTP/2 and WebSocket protocols. Through multiplexed requests across a single connection, HTTP/2 reduces network traffic. WebSocket allows developers to set up longstanding TCP connections between client and server while minimizing power consumption.

Additional advanced features supported by Application Load Balancer include:

  • User authentication via OpenID, SAML, LDAP, Active Directory and third-party social identity providers like Facebook and Google;
  • Content-based routing to enable the development of applications with multiple microservices that can be scaled independently in response to the load on individual services;
  • Target groups, which are logical groupings of servers behind a load balancer that can exist independently;
  • Container-based applications where one instance can host several containers that listen for network traffic on multiple ports behind the same target group;
  • Performing fine-grained, port-level health checks; and
  • Access logs with additional information that are stored in a compressed format.
evolution of AWS load balancing
Load Balancing in AWS has evolved over the years to better meet the needs of users.

Application Load Balancer components

Application Load Balancer components include:

  • Load balancer. The load balancer distributes incoming application traffic across multiple targets (e.g., EC2 instances in multiple AWS availability zones) to increase application availability.
  • Listener. A listener checks for connection requests from clients using the protocol and port configured by an organization per rules that determine how Application Load Balancer routes requests to registered targets.
  • Target group. Application Load Balancer routes requests to one or more registered targets (e.g., EC2 instances) using the protocol and port number configured by an organization.

When Application Load Balancer receives requests, it evaluates the listener rules to determine which rule to apply. Next, it selects a target from the target group for the selected rule's action. Routing is performed independently for each target group.

The default routing algorithm is round robin. However, users can also specify the least outstanding requests routing algorithm.

Targets can be added to or removed from the Application Load Balancer as needs change without disrupting the flow of requests to the application.

How much does Application Load Balancer cost?

Amazon bills Application Load Balancer customers by the hour for the use of Load Balancer Capacity Units (LCUs). The rate is $0.008 per LCU, per hour. One LCU refers to the number of new connections per second, the number of active connections and data transfers.

An LCU is consumed:

  • For 25 new connections per second
  • For 3,000 active connections per second
  • For 2.22 Mbps of bandwidth (data transfer)

Billing is based on the highest dimension.

The hourly rate for use of an Application Load Balancer is lower than the cost of a Classic Load Balancer.

This was last updated in June 2021

Continue Reading About Application Load Balancer

Dig Deeper on AWS cloud development