L4/L7 Timeout

Basic Concept

L4/L7 timeout is a feature provided by ALB. It is used to configure the timeout time for L4/L7 proxy.

Timeout is implemented through a Lua script, and Nginx does not need to reload when it is changed.

CRD

timeout:
  properties:
    proxy_connect_timeout_ms:
      type: integer
    proxy_read_timeout_ms:
      type: integer
    proxy_send_timeout_ms:
      type: integer
  type: object

Config can be configured on:

  • Frontend: .spec.config.timeout
  • Rule: .spec.config.timeout

What Timeout Means

There are three types of timeouts:

  1. proxy_connect_timeout_ms: Defines the timeout for establishing a connection with the upstream server. If the connection cannot be established within this time, the request will fail.

  2. proxy_read_timeout_ms: Defines the timeout for reading a response from the upstream server. The timeout is set between two successive read operations, not for the entire response. If no data is received within this time, the connection is closed.

  3. proxy_send_timeout_ms: Defines the timeout for sending a request to the upstream server. Similar to the read timeout, this is set between two successive write operations. If no data can be sent within this time, the connection is closed.

Ingress Annotation

AnnotationDescription
nginx.ingress.kubernetes.io/proxy-connect-timeoutCorresponds to proxy_connect_timeout_ms in CR
nginx.ingress.kubernetes.io/proxy-read-timeoutCorresponds to proxy_read_timeout_ms in CR
nginx.ingress.kubernetes.io/proxy-send-timeoutCorresponds to proxy_send_timeout_ms in CR

Port Level Timeout

You can configure timeout on a port directly, which is used as an L4 timeout.