Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference between "idle_timeout" and "stream_idle_timeout" in HttpConnectionManager? #7578

Closed
bmgoau opened this issue Jul 15, 2019 · 5 comments
Labels
area/docs stale stalebot believes this issue/PR has not been touched recently

Comments

@bmgoau
Copy link

bmgoau commented Jul 15, 2019

Hey Team,

We're trying to set a timeout on idle keepalive HTTP sessions that are not in the process of sending a request nor waiting for a reply. So your stock standard idle keepalive session.

We're not using gRPC, just vanilla HTTP.

We're curious how "stream_idle_timeout" differs from "idle_timeout" and which one is more appropriate to set and why?

https://www.envoyproxy.io/docs/envoy/latest/api-v2/config/filter/network/http_connection_manager/v2/http_connection_manager.proto

Looking at the documentation for those two they seem quite similar.

Is "stream_idle_timeout" specific to gRPC identified sessions? A few of us here looked through the code and (we're not experts with the code base) couldn't tell how "idle_timeout" and "stream_idle_timeout" differ from one another, one of us even believes they are effectively identical as a code level and mean the same thing.

@mattklein123
Copy link
Member

"idle_timeout" is the time that a connection will stay alive when there are no active streams.

"stream_idle_timeout" is the time that a stream will stay alive when there are is no activity in either direction (headers, data, trailers, etc.).

Doc updates appreciated!

@kopper
Copy link

kopper commented Jul 15, 2019

Related issue #7420

@bmgoau
Copy link
Author

bmgoau commented Jul 15, 2019

Thanks @mattklein123 .

In this sense if we translated the timers to nginx land we would have:

HttpConnectionManager.idle_timeout =
http://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_timeout and http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive_timeout
Effectively how long we will keep around a TCP connection that isn't in the process of sending a request or waiting for a reply. It's idle in the sense that its being held open opportunistically for a possible new conversation, to avoid the overhead of negotiating TCP and TLS again.

HttpConnectionManager.stream_idle_timeout is somewhat similar to http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_send_timeout and
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout
In that the TCP connection is "expected" to have some data flowing in either direction, for example a HTTP response from a server, but is "idle" in the sense that no bits and bytes are flowing on the connection. For example the upstream/server is doing work to prepare the response, or is completely stuck on some long running response.

It's too late now, but I might not have used the term "idle" in the configuration key stream_idle_timeout - and possibly gone with:

idle_timeout - how long HTTP keepalive TCP sessions should live if not being used.
connect_timeout - how long to wait for a TCP handshake and SSL handshake to succeed.
request_timeout - how long we are allowed to take to write out our request to the upstream server.
response_timeout - how long we will wait on the server to respond to a completely written request
total_stream_timeout - how long a TCP session associated with a live stream/HTTP conversation context is allowed to have no data flowing in either direction (should be longer than request_timeout + read/response_timeout)

Just my 2c :)

Thanks again!

@stale
Copy link

stale bot commented Aug 15, 2019

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Aug 15, 2019
@stale
Copy link

stale bot commented Aug 22, 2019

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.

@stale stale bot closed this as completed Aug 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs stale stalebot believes this issue/PR has not been touched recently
Projects
None yet
Development

No branches or pull requests

3 participants