Skip to content

AWS ALB - Connection idle timeout vs HTTP client keepalive duration

0

The documentation says

  • "Connection idle timeout" controls the max amount of time a connection can be idle between ALB-client & ALB-server.
  • "HTTP client keepalive duration" controls the max amount of time a client can have persistent HTTP connection which can be reused

My question is if connection idle timeout closes a connection in say 2 minutes (which includes ALB-client too), what is the point of client keepalive (ALB-client) even if it is set to say 2 hours. Wouldn't that get ignored?

asked 10 months ago2.5K views
2 Answers
0

You've identified an important distinction between these two settings on Application Load Balancers.

The connection idle timeout and HTTP client keepalive duration serve different purposes:

  1. Connection idle timeout: This setting determines how long an inactive connection (where no data is being transferred) can remain open before the ALB closes it. The default is 60 seconds. If no data flows through an established connection for this duration, the ALB will terminate it.

  2. HTTP client keepalive duration: This newer feature (released March 2024) specifies the maximum total lifetime of a persistent HTTP connection between a client and the ALB, regardless of activity. After this duration elapses, the ALB will accept one more request and then gracefully close the connection by sending either a "Connection: close" header (for HTTP 1.x) or a GOAWAY frame (for HTTP/2). The default is 3600 seconds (1 hour), and it can be set between 60 seconds and 7 days.

You're correct that if the connection idle timeout is set to 2 minutes, any connection that remains idle for that period will be closed, regardless of the HTTP client keepalive duration setting. The keepalive duration only comes into play for active connections that are regularly sending data.

The HTTP client keepalive duration is particularly useful for:

  • Gracefully terminating connections during Blue/Green deployments or rollbacks
  • Migrating legacy applications
  • Evacuating Availability Zones using zonal shift

So while the idle timeout handles inactive connections, the keepalive duration provides an upper bound on how long even active persistent connections can remain open before being gracefully refreshed.
Sources
Edit attributes for your Application Load Balancer - Elastic Load Balancing
Application Load Balancer enables configuring HTTP client keepalive duration
Configure your Classic Load Balancer - Elastic Load Balancing

answered 10 months ago
EXPERT
reviewed 10 months ago
0

Think of this example

  • Keep-alive duration = "client is willing to stay in a Zoom meeting for 2 hours."
  • ALB idle timeout = "Zoom kicks you out after 2 minutes of silence."

No matter what the client wants, the server (ALB) ultimately controls the session’s lifetime.

EXPERT
answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.