3.1: Reset KeepAliveTimeout on HTTP/2 ping #24858
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Kestrel has a KeepAliveTimeout option. This timeout controls how long Kestrel will keep an inactive HTTP connection alive before closing it. The default value is 2 minutes. The behavior is important because a client might connect to a server, then their network drops, and Kestrel needs a way to remove the unused connection.
In HTTP/1.1 and HTTP/2 the timeout is reset whenever a new request starts. The change in this PR extends HTTP/2 to also reset the timeout when a HTTP/2 ping is received on the connection.
Keeping a connection that is not receiving requests via HTTP/2 pings offers performance benefits. It keeps connections "warm" so that the first request after a period of inactivity does not need to reestablish the connection (open TCP socket, make TLS handshake, make HTTP/2 connection handshake) for the first request.
Customer Impact
Performance
Regression?
No
Risk (see taxonomy)
Low-Medium. The code change is small. However there is the possibility that resetting the KeepAliveTimeout in a new place (processing incoming pings) could have unforeseen side-effects.
Link the PR to the original issue and/or the PR to master.
Original issue: #24601
Changes from #24644 and #24804
Packaging impact? (if a libraries change)