Copyright (c) 2025 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

5.1.2. Load Balancing for Scalability & Performance (ALB, NLB, GLB)

Load balancers (ALB, NLB, GLB) efficiently distribute incoming application traffic, ensuring scalability, high availability, and optimal performance for diverse workloads by operating at different network layers.

Scenario: You need to load balance HTTP/S traffic for a web application, routing requests based on URL paths. Separately, you have a gaming application that requires extremely low-latency TCP connections and static IP addresses for its backend servers.

Elastic Load Balancing (ELB) automatically distributes incoming application traffic across multiple targets (e.g., EC2 instances, containers, Lambda functions). For network specialists, selecting the right load balancer type is crucial for meeting specific application needs.

Key ELB Types for Scalability & Performance:
  • Application Load Balancer (ALB):
  • Network Load Balancer (NLB):
    • Layer: Layer 4 (Transport layer - TCP/UDP/TLS).
    • Features: Designed for extreme performance and ultra-low latency, handles millions of requests per second. Provides static IP addresses.
    • Use Cases: High-throughput, low-latency workloads (e.g., gaming, IoT, financial trading), applications that require static IP addresses.
  • Gateway Load Balancer (GLB):
    • Layer: Layer 3 (Network layer) and Layer 4 (Transport layer).
    • Features: Transparently deploys and manages virtual appliances (e.g., firewalls, intrusion detection/prevention systems) in your network path. Uses GENEVE protocol.
    • Use Cases: Centralizing inspection of traffic, managing fleets of third-party network virtual appliances.
Practical Implementation: Creating an ALB and NLB (Conceptual)
# 1. Create an Application Load Balancer (ALB)
aws elbv2 create-load-balancer \
  --name MyWebAppALB \
  --subnets subnet-0a1b2c3d subnet-0e4f5g6h \
  --security-groups sg-0abcdef1234567890 \
  --scheme internet-facing

# 2. Create a Network Load Balancer (NLB)
aws elbv2 create-load-balancer \
  --name MyGamingNLB \
  --type network \
  --subnets subnet-0a1b2c3d subnet-0e4f5g6h \
  --scheme internet-facing \
  --tags Key=Name,Value=GamingNLB

⚠️ Common Pitfall: Choosing an ALB for a non-HTTP/S workload or when static IP addresses are required. ALBs are Layer 7 and do not provide static IPs. NLBs are the correct choice for these scenarios.

Key Trade-Offs:
  • Layer 7 Features (ALB) vs. Raw Performance/Static IPs (NLB): ALBs offer advanced routing and application-level features but introduce more latency. NLBs offer extreme performance and static IPs but lack Layer 7 intelligence.

Reflection Question: How do load balancers (ALB for Layer 7, NLB for Layer 4, GLB for virtual appliances) efficiently distribute incoming application traffic, ensuring scalability, high availability, and optimal performance for diverse workloads by operating at different network layers?