TCP/HTTP Keepalive

Basic Concept

  1. ALB supports keepalive configuration at the port level. It can be configured on the frontend.

  2. Keepalive is between the client and ALB, not between ALB and the backend.

  3. It is implemented through the Nginx configuration, and Nginx needs and will automatically reload when the configuration is changed.

  4. TCP keepalive and HTTP keepalive are two different concepts:

    1. TCP keepalive is a TCP protocol feature that sends periodic probe packets to check if the connection is still alive when there is no data transmission. It helps detect and clean up dead connections.
    2. HTTP keepalive (also known as persistent connections) allows multiple HTTP requests to reuse the same TCP connection, avoiding the overhead of establishing new connections. This improves performance by reducing latency and resource usage.

CRD

keepalive:
  properties:
    http:
      description: Downstream L7 keepalive
      properties:
        header_timeout:
          description: Keepalive header timeout. Default is not set.
          type: string
        requests:
          description: Keepalive requests. Default is 1000.
          type: integer
        timeout:
          description: Keepalive timeout. Default is 75s.
          type: string
      type: object
    tcp:
      description: TCPKeepAlive defines TCP keepalive parameters (SO_KEEPALIVE)
      properties:
        count:
          description: The TCP_KEEPCNT socket option.
          type: integer
        idle:
          description: The TCP_KEEPIDLE socket option.
          type: string
        interval:
          description: The TCP_KEEPINTVL socket option.
          type: string
      type: object
  type: object

It can only be configured on the frontend.

ON THIS PAGE