Skip to content

Commit

Permalink
docs: document client idle timeout (#3325)
Browse files Browse the repository at this point in the history
* docs: document client idle timeout

Signed-off-by: Yael Shechter <yael.shechter@sap.com>

* fix pr comments

Signed-off-by: Yael Shechter <yael.shechter@sap.com>

---------

Signed-off-by: Yael Shechter <yael.shechter@sap.com>
  • Loading branch information
yaelSchechter authored May 7, 2024
1 parent d048a9f commit 019a5e1
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 0 deletions.
65 changes: 65 additions & 0 deletions site/content/en/latest/tasks/traffic/client-traffic-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -573,5 +573,70 @@ curl -v http://$GATEWAY_HOST/get \
request timeout
```
### Configure Client HTTP Idle Timeout
The idle timeout is defined as the period in which there are no active requests. When the idle timeout is reached the connection will be closed.
For more details see [here](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-idle-timeout:~:text=...%7D%0A%7D-,idle_timeout,-(Duration)%20The).
{{< tabpane text=true >}}
{{% tab header="Apply from stdin" %}}
```shell
cat <<EOF | kubectl apply -f -
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: ClientTrafficPolicy
metadata:
name: client-timeout
spec:
targetRef:
group: gateway.networking.k8s.io
kind: Gateway
name: eg
timeout:
http:
idleTimeout: 5s
EOF
```
{{% /tab %}}
{{% tab header="Apply from file" %}}
Save and apply the following resource to your cluster:
```yaml
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: ClientTrafficPolicy
metadata:
name: client-timeout
spec:
targetRef:
group: gateway.networking.k8s.io
kind: Gateway
name: eg
timeout:
http:
idleTimeout: 5s
```
{{% /tab %}}
{{< /tabpane >}}
Curl the example app through Envoy proxy:
```shell
openssl s_client -crlf -connect $GATEWAY_HOST:443
```
You should expect the connection to be closed after 5s.
You can also check the number of connections closed due to idle timeout by using the following query:
```shell
envoy_http_downstream_cx_idle_timeout{envoy_http_conn_manager_prefix="<name of connection manager>"}
```
The number of connections closed due to idle timeout should be increased by 1.
[ClientTrafficPolicy]: ../../../api/extension_types#clienttrafficpolicy
[BackendTrafficPolicy]: ../../../api/extension_types#backendtrafficpolicy
65 changes: 65 additions & 0 deletions site/content/en/v1.0.1/tasks/traffic/client-traffic-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,5 +464,70 @@ curl -v http://$GATEWAY_HOST/get \
request timeout
```
### Configure Client HTTP Idle Timeout
The idle timeout is defined as the period in which there are no active requests. When the idle timeout is reached the connection will be closed.
For more details see [here](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-idle-timeout:~:text=...%7D%0A%7D-,idle_timeout,-(Duration)%20The).
{{< tabpane text=true >}}
{{% tab header="Apply from stdin" %}}
```shell
cat <<EOF | kubectl apply -f -
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: ClientTrafficPolicy
metadata:
name: client-timeout
spec:
targetRef:
group: gateway.networking.k8s.io
kind: Gateway
name: eg
timeout:
http:
idleTimeout: 5s
EOF
```
{{% /tab %}}
{{% tab header="Apply from file" %}}
Save and apply the following resource to your cluster:
```yaml
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: ClientTrafficPolicy
metadata:
name: client-timeout
spec:
targetRef:
group: gateway.networking.k8s.io
kind: Gateway
name: eg
timeout:
http:
idleTimeout: 5s
```
{{% /tab %}}
{{< /tabpane >}}
Curl the example app through Envoy proxy:
```shell
openssl s_client -crlf -connect $GATEWAY_HOST:443
```
You should expect the connection to be closed after 5s.
You can also check the number of connections closed due to idle timeout by using the following query:
```shell
envoy_http_downstream_cx_idle_timeout{envoy_http_conn_manager_prefix="<name of connection manager>"}
```
The number of connections closed due to idle timeout should be increased by 1.
[ClientTrafficPolicy]: ../../../api/extension_types#clienttrafficpolicy
[BackendTrafficPolicy]: ../../../api/extension_types#backendtrafficpolicy

0 comments on commit 019a5e1

Please sign in to comment.