projectcontour / contour

Contour is a Kubernetes ingress controller using Envoy proxy.
https://projectcontour.io
Apache License 2.0
3.7k stars 672 forks source link

Clarification on idle and idleConnection #6612

Open rahtr opened 1 month ago

rahtr commented 1 month ago

What question do you have?: I am trying to find a clear distinction between the idle and idleConnection configuration? Based on the details in this doc--> https://projectcontour.io/docs/main/config/api/#projectcontour.io/v1.TimeoutPolicy, it seems the

proxy:
  idle: 30s
  idleConnection: 1h

Explanation: idle: 30s: This setting means that if a connection between the proxy and the client is idle for 30 seconds during a single request/response cycle, the proxy will consider it idle. For HTTP/1.1, this applies to the time between requests on the same connection. For HTTP/2, it applies to the inactivity of streams.

Example:

idleConnection: 1h: This setting means that if the connection between the proxy and the upstream service remains idle (no requests) for 1 hour, the proxy will close it.

Example:

Combined Behavior: During a request/response cycle: If the idle timeout is reached (30 seconds without new requests on HTTP/1.1 or inactivity in HTTP/2 streams), the connection is considered idle, and the proxy might close it.

Between requests: The idleConnection timeout (1 hour) ensures that even if the proxy is idle between requests, it won’t close the connection to the upstream service until 1 hour of inactivity has passed.

If the above understanding is correct then for this configuration:

proxy:
  idle: 300s
  idleConnection: 200s

If the connection to the upstream service is closed due to the idleConnection timeout, and the client then tries to send a request, it would indeed result in a failure if the proxy cannot establish a new connection to the upstream service in time.

Anything else you would like to add: [Miscellaneous information that will assist in solving the issue.]

Environment:

github-actions[bot] commented 1 month ago

Hey @rahtr! Thanks for opening your first issue. We appreciate your contribution and welcome you to our community! We are glad to have you here and to have your input on Contour. You can also join us on our mailing list and in our channel in the Kubernetes Slack Workspace