Best Practices

ALB vs. ELB

VectorUSA logo

Load balancers are critical components in AWS systems, and selecting the most suitable option might prove confusing for some users. Choosing the right option enables users to distribute various tasks across resources, resulting in an optimized process. Operating a network without load balancers may result in significant delays in web services during a spike in user requests. 

The modern digital age has led to a significant increase in user requests from social media use and IoT operations, increasing the importance of load balancers as critical components in web traffic management. 

Essentially, a suitable load balancer serves as the gatekeeper or contact point between client devices and backend servers, driving application responsiveness, scalability, and availability while reducing the risk of traffic overload (i.e., increased fault tolerance). 

Load balancers follow a preset algorithm with varying complexities, determining request distribution across servers. The most widely used algorithms include round-robin, hashing methods, least response time, and custom loads. 

Understanding ALBs (Application Load Balancers)

ALBs operate from the application layer or the seventh layer of the OSI (Open Systems Interconnections) model, which drives communications among multiple systems. An ALB receives the request and evaluates listener (a process that checks for connection requests) rules through prioritized order, essentially routing requests based on content to a specific subgroup. 

Users can choose to route the algorithm of listener rules specifically to different target groups. Additionally, system administrators can conveniently add or remove target groups according to the changing priorities and demands of a project or organization without causing disruptions to the overall requests received by the application.  

Users can combine ALB with various other AWS services to optimize the availability and scalability of applications. These services may include AWS Certificate Manager, Amazon EC2, Amazon Route 53, AWS WAF, and Amazon CloudWatch. 

For instance, Amazon CloudWatch offers users real-time application monitoring capabilities, providing quick error detection and troubleshooting in response to system anomalies or performance delays. With Amazon Route 53, users can create an alias record, listing multiple IP addresses for responding to DNS requests, an effective web solution for managing geographically distributed servers. 

How ALB Works

ALB primarily distributes network load in a public cloud to optimize availability and stability. The ALB monitors the health of applications within the seventh layer of the OSI model and will specifically route traffic to healthy registered targets. 

Specifically, ALB assesses data packets identified with HTTP and HTTPS headers, providing developers with detailed reports of each check that zooms in on the specific code and HTTP-related errors encountered. 

AWS users can apply ALB through internal load balancing in front of AWS EC2 instances, applications (through Rest API), or containers. Multiple services in a complex environment may share a single ALB load balancer through path-based routings, such as routing it to different server clusters based on application needs. Users can route up to 10 applications behind a single ALB.

Core Concepts of ALB

ALB includes various components that users should familiarize themselves with for optimized network configuration. These include rules, targets, priorities, and conditions. The rules of ALB set the desired action that matches a client’s request by fulfilling a specific condition or path pattern. An ALB determines the sequence of rules fulfillment based on priority, according to numerical values in ascending order.  

Understanding ELBs (Elastic Load Balancers)

Introduced by AWS in 2009, the ELB, also known as the classic load balancer, is a software-based load balance that automates the traffic distribution process across multiple targets. These targets may include containers and IP addresses.

The ELB operates from the fourth layer (i.e., the transport layer) of the OSI model and transfers requests based on the applied protocol of TCP or IP and links with a similar backend target. For instance, when an ELB receives a client request from a TCP port, it routes the request based on the rules pre-configured during a load balancer setup. 

The classic load balancer serves various functions to provide application stacks with added security, easier management, and reliability. 

Specifically, ELB provides web networks with functions that include:

  • User verification with a public key
  • Centralized administration of SSL certificates
  • Traffic distribution among registered and healthy instances
  • Support for IPv4 and IPv6

ELB provides a single entry point for users of EC2 instances, efficiently distributing traffic across available targets. With configured health checks, ELBs can closely monitor the health of each registered target and limit traffic distribution to healthy locations, improving fault tolerance.

How ELB Works  

Usually, with classic load balancers, users register instances directly with the load balancer when creating a load balancer node within an enabled availability zone (AZ). 

Having multiple servers behind AZs within a region improves the availability of networks, enabling the ELB to reroute traffic to available AZs during inaccessibility. ELB routes traffic evenly among AZs during default configurations. However, the default setting could lead to overload/load imbalance if servers are not responding to the requests. 

The activation of cross-zone load balancing enables each balancer node to distribute traffic across registered targets across all enabled AZs. Alternatively, disabling cross-zone load balancing limits each balancer node to distributing traffic to its specific AZ. As such, cross-zone load balancing mitigates the risks of potential load imbalances. 

Comparing ALB vs. ELB

ALBs and ELBs share several core functions and capabilities despite their specialized features. For starters, they feature high availability and scalability, and users can choose to add or remove resources when required without disrupting the overall request flow from applications. ALB and ELB support primary functions that include:

  • Sticky sessions — the system assigns an attribute to users via cookies and IP tracking.
  • SSL termination — decrypting encrypted traffic before distribution to registered targets.
  • Idle session terminations — the load balancer automatically closes a session after a pre-configured period of inactivity.
  • Connection draining — a feature that enables users to safely remove instances without prematurely terminating client connections.
  • Health checks — providing health checks to identify anomalies in instances for further action. 

The Differences Between ALB and ELB

In 2016 AWS improved its original ELB program with ALB, which provides users with additional features and enhanced functions. 

For instance, while ELB enables users to add and remove listeners according to changing priorities, the ALB provides the extra feature of viewing and editing listener routing rules. As such, users can conveniently direct routes to a predefined target group. 

ALB also rectifies some of the limitations of ELB, which include:

  • The unsupported function of forwarding traffic to more than one port per instance
  • Incompatibilities with EKS servers that run on Fargate
  • Incapabilities of delivering traffic to IP addresses, which prevents traffic to targets outside AWS
  • Lack of support for WebSockets and HTTP/2
  • Serves only one permitted domain name

One of the most significant differences between ALB and ELB lies in the system of their routing process. While ELB only routes traffic based on routing number, ALB facilitates context-driven routing based on multiple references, including query string perimeter, source IP, port number, hostname, and path. 

Additionally, ALB supports Server Name Indication (SNI), enabling it to bypass the conventional limitations of the ELB in serving a single domain name. ALB offers users native HTTP/2 and WebSocket support via multiple requests delivered through a single connection. 

ALB Provides Built-in Capabilities

ELB only allows routing via a single port, while ALB supports distribution through multiple ports and lambda functions. Lambda functions enable users to manage and run various functions, build websites through serverless coding, and create customized ALB targets through serverless methods.  

ALB offloads and optimizes server functions by performing advanced tasks directly from its program, including a preconfigured redirection or fixed response and user authentication through LDAP, Microsoft AD, and Google. The added load balancer function enables applications to focus on their business logic for increased performance. 

Other notable built-in ALB capabilities include:

  • Container-based application support, enabling a single instance to host multiple containers listening for network traffic behind the same target group.
  • The capabilities of performing fine-grained health checks at the port level. Specifically, ALB has console support for filtering by tags, resource, and resource-based permissions, so users can use IAM policies to implement the fine-grain controls.
  • Providing detailed access logs stored securely in a compressed format.

Access Logs 

ALB’s access logs include a detailed breakdown of information that consists of the original HTTP response and response_processing_time, which determines the time required to transfer a client request, request type, and time stamps. 

Summary of ALB vs. ELB

Users might find it advantageous to apply ALB in balancing a load of HTTP/HTTPs web traffic with a specific path or host-based routing that drives context-driven requests. These will help expedite processes in complex environments, such as the microservice landscape. 

While the ALB might seem like a complete upgrade of the classic ELB, each load balancing solution has its recommended uses. For instance, ALB functions better for content-based routing, especially in response to modern trends like the rise of microservices that require the rapid and reliable distribution of complex applications. 

Users who operate from a network with carefully defined load balancers for each server with direct links between URLs and services will likely find it more cost-effective and practical to apply the classic ELB in handling their traffic needs. 

Also, users with old AWS accounts need to note that ELB is the only load balancer that works on EC2-Classic and supports application-defined sticky session cookies. However, ELB/classic load balancer users should note that AWS has not released new updates for the program and will retire the EC2-Classic by August 15, 2022, so users should consider a systematic migration to a VPC, which avoids interrupting their existing workload. 

What to Expect With Efficient Load Balancing 

Upgrading from a classic load balancer can bring users a wide range of benefits that optimize the overall performance of their networks

Reinforced Security

Modern load balancers are compatible with the VPC, which supports multiple security features such as SSL/TLS decryption and user verification. System administrators will have the option of establishing private connections through AWS PrivateLink between the VPC and load balancers through a VPC endpoint, enabling secure offline traffic distributions.  

Additionally, modern load balancers continue to include more TLS policies, such as ELB Security Policy FS 2018 06, that control TLS and cipher suites. These implementations will optimize forward secrecy (i.e., safeguarding the security of session keys) across application load balancing. 

Unmatched Availability

Users can expect uninterrupted traffic across multiple healthy targets throughout multiple AZs, keeping requests and data running with optimized efficiency. 

Newfound Versatility 

Modern load balancing enables users to function across AWS and on-premise systems via a single load balancer. System administrators will face less friction in managing, migrating, or transferring control (i.e., failover) to on-premise resources when required. 

Greater Flexibility 

Updated load balancing enables users to autoscale effectively according to varying application workloads. Additionally, users can host multiple applications from a single instance while maintaining individual security groups for optimized communication between applications. 

Closing Thoughts 

AWS continues to expand its load-balancing options, giving users greater flexibility in distributing their traffic for efficient server functions. The company launched its Network Load Balancer (NLB) in 2017, aimed at handling millions of requests per second. NLB provides users with a wide range of traffic management improvements, including long-running connections that power demanding IoT, gaming, messaging applications, and failover support. 

System developers have also created specialized services to manage authentication, authorization, and accounting through AAA computer security solutions for reduced cost, improved scalability, and optimized efficiency. 

With similar fees for each load balancing solution, the price point would rarely serve as a factor in deciding on the best fit. Ultimately, the chosen load balancing method depends on the underlying location where a workload functions. However, the complete progression toward ALB use seems clear within the horizon. 

Overall, AWS’s load balancers integrate seamlessly with the rest of its services. Choosing the most suitable loader ultimately depends on the complexity of existing network infrastructure, environment, and demands.  

Sign up to access comprehensive monitoring and alerts across AWS networks across unlimited devices.

Subscribe to our blog

Get articles like this delivered straight to your inbox