Course contentsShow
← Cloud and Infrastructure
Lesson 283 of 2,9895. Load Balancing and Traffic ManagementFree lesson

HTTP/2 and gRPC Load Balancing

Configure load balancers to handle modern protocols including HTTP/2 multiplexing and gRPC connections.

HTTP/2 and gRPC Load Balancing

What You'll Learn

You'll learn how to configure load balancers to handle modern protocols like HTTP/2 and gRPC, which behave differently from traditional HTTP/1.1 traffic.

The Core Challenge

Traditional HTTP/1.1 creates a new connection for each request or maintains multiple connections per client. HTTP/2 and gRPC, however, use multiplexing—sending many requests simultaneously over a single, long-lived TCP connection.

Why This Matters for Load Balancing

Imagine a highway with many lanes (HTTP/1.1) versus a single super-efficient lane where cars can overlap and pass through simultaneously (HTTP/2). Traditional load balancers distribute connections across backend servers, but with HTTP/2, all requests from one client might stick to a single backend through one connection—creating uneven load distribution.

How to Handle HTTP/2 and gRPC

Application Load Balancers (ALB) automatically handle HTTP/2 by:

  • Accepting HTTP/2 connections from clients
  • Converting them to HTTP/1.1 for backend targets (or maintaining HTTP/2 end-to-end)
  • Distributing individual requests across target groups, even within a single connection

For gRPC (which runs over HTTP/2):

  • ALB supports gRPC natively with proper routing based on service names and methods
  • Health checks work with gRPC-specific checks
  • You must enable HTTP/2 protocol support on the load balancer listener

Network Load Balancers (NLB) handle gRPC differently:

  • Pass-through at Layer 4 maintains the long-lived connection
  • Useful when you need end-to-end encryption or client IP preservation
  • Backends must handle load distribution themselves

Configuration Considerations

Enable HTTP/2 support on your ALB listener, ensure your target groups understand gRPC health checks, and monitor connection distribution to avoid "sticky connection" imbalances where one backend gets overloaded.

Key Takeaway: HTTP/2 and gRPC use persistent multiplexed connections that require Layer 7 (ALB) load balancing to properly distribute individual requests, not just connections, across backend servers.