このページは、まだ日本語ではご利用いただけません。翻訳中です。
旧バージョンのドキュメントを参照しています。 最新のドキュメントはこちらをご参照ください。
Mesh Timeout
This policy uses new policy matching algorithm. Do not combine with Timeout policy.
TargetRef support matrix
TargetRef type | top level | to | from |
---|---|---|---|
Mesh | ✅ | ✅ | ✅ |
MeshSubset | ✅ | ❌ | ❌ |
MeshService | ✅ | ✅ | ❌ |
MeshServiceSubset | ✅ | ❌ | ❌ |
MeshHTTPRoute | ✅ | ❌ | ❌ |
To learn more about the information in this table, see the matching docs.
Configuration
This policy enables Kong Mesh to set timeouts on the inbound and outbound connections depending on the protocol. Using this policy you can configure TCP and HTTP timeouts. Timeout configuration is split into two sections: common configuration and HTTP configuration. Common config is applied to both HTTP and TCP communication. HTTP timeout are only applied when service is marked as http. More on this in protocol support section.
MeshTimeout policy lets you configure multiple timeouts:
connectionTimeout
idleTimeout
http.requestTimeout
http.streamIdleTimeout
http.maxStreamDuration
http.maxConnectionDuration
Timeouts explained
Connection timeout
Connection timeout specifies the amount of time DP will wait for a TCP connection to be established.
Idle timeout
For TCP connections idle timeout is the amount of time that the DP will allow a connection to exist with no inbound or outbound activity. On the other hand when connection in HTTP time at which an inbound or outbound connection will be terminated if there are no active streams
HTTP request timeout
Request timeout lets you configure how long the data plane proxy should wait for the full response. In details, it spans between the point at which the entire request has been processed by DP and when the response has been completely processed by DP.
HTTP stream idle timeout
Stream idle timeout is the amount of time that the data plane proxy will allow an HTTP/2 stream to exist with no inbound or outbound activity. This timeout is strongly recommended for all requests (not just streaming requests/responses) as it additionally defends against a peer that does not open the stream window once an entire response has been buffered to be sent to a downstream client.
Stream timeouts apply even when you are only using HTTP/1.1 in you services. This is because every connection between data plane proxies is upgraded to HTTP/2.
HTTP max stream duration
Max stream duration is the maximum time that a stream’s lifetime will span. You can use this functionality when you want to reset HTTP request/response streams periodically.
HTTP max connection duration
Max connection duration is the time after which an inbound or outbound connection will be drained and/or closed, starting from when it was first established. If there are no active streams, the connection will be closed. If there are any active streams, the drain sequence will kick-in, and the connection will be force-closed after 5 seconds.
Examples
Simple outbound HTTP configuration
This configuration will be applied to all data plane proxies inside of Mesh.
Simple TCP configuration
Simple configuration for inbound applied to specific service
This configuration will be applied to backend
service inbound.
Full config applied to inbound and outbound of specific service
This timeout configuration will be applied to all inbound connections to frontend
and outbound connections
from frontend
to backend
service
Target MeshHTTPRoute
Timeouts like http.requestTimeout
and http.streamIdleTimeout
are configurable per route.
If a MeshHTTPRoute
creates routes on the outbound listener of the service then MeshTimeout
policy can configure timeouts on these routes.
In the following example the MeshHTTPRoute
policy route-to-backend-v2
redirects all requests to /v2*
to backend
instances with version: v2
tag.
MeshTimeout
backend-v2
configures timeouts only for requests that are going through route-to-backend-v2
route.
You can see in the following route that the top level targetRef
matches the previously defined MeshHTTPRoute
.
Defaults
Property | default |
---|---|
idleTimeout |
1h |
connectionTimeout |
5s |
http.requestTimeout |
15s |
http.streamIdleTimeout |
30m |
http.maxStreamDuration |
0s |
http.maxConnectionDuration |
0s |