-
Notifications
You must be signed in to change notification settings - Fork 688
Support a handler for checking connection status using Ping frame in HTTP/2 #3612
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
Conversation
171dfc5 to
202d036
Compare
18196bd to
231b27d
Compare
reactor-netty-http/src/main/java/reactor/netty/http/Http2SettingsSpec.java
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/Http2SettingsSpec.java
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/Http2SettingsSpec.java
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/Http2SettingsSpec.java
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/client/Http2ConnectionLivenessHandler.java
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/client/Http2ConnectionLivenessHandler.java
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/client/Http2ConnectionLivenessHandler.java
Show resolved
Hide resolved
reactor-netty-http/src/main/java/reactor/netty/http/client/HttpClientConfig.java
Outdated
Show resolved
Hide resolved
...y-http/src/test/java/reactor/netty/resources/PooledConnectionProviderDefaultMetricsTest.java
Show resolved
Hide resolved
reactor-netty-http/src/test/java/reactor/netty/http/client/HttpClientTest.java
Outdated
Show resolved
Hide resolved
|
@raccoonback Can you rebase against branch |
231b27d to
a06c842
Compare
|
@violetagg |
a06c842 to
8c4cdbc
Compare
|
@raccoonback I'll review this PR later this week |
|
@raccoonback Nice idea! I think that we can reuse our current I think this feature is interesting for both server and client, similar to TCP keep-alive that we support for both of them. |
|
@violetagg
Looking forward to your feedback! 😊 |
Yes
Yes
Yes
We may need to move I think that this feature is interesting for both client and server. Wdyt? |
|
Thank you for the detailed explanation! |
|
@violetagg |
|
@violetagg |
yep I'll check it next week |
|
@violetagg |
yeah I started reviewing it and later was distracted ... let me do the release tomorrow and we will include it in the next release ... |
|
@violetagg |
|
@raccoonback I'm working on this one |
|
@violetagg |
|
@violetagg |
Introduce PING frame support for proactive connection health monitoring on idle HTTP/2 connections. The feature sends PING frames to detect unresponsive peers and close stale connections. Configuration via Http2SettingsSpec: - pingAckTimeout: Timeout for ACK response - pingAckDropThreshold: Maximum PING attempts (default: 1) Requires idle timeout configuration: - Client: ConnectionProvider.maxIdleTime - Server: HttpServer.idleTimeout The feature is opt-in and integrates automatically with connection pool eviction (client) and idle timeout handling (server). This implementation is based on PR #3612, reduces the scope and adds HttpClient support. Co-authored-by: raccoonback <[email protected]> Signed-off-by: Violeta Georgieva <[email protected]>
Introduce PING frame support for proactive connection health monitoring on idle HTTP/2 connections. The feature sends PING frames to detect unresponsive peers and close stale connections. Configuration via Http2SettingsSpec: - pingAckTimeout: Timeout for ACK response - pingAckDropThreshold: Maximum PING attempts (default: 1) Requires idle timeout configuration: - Client: ConnectionProvider.maxIdleTime - Server: HttpServer.idleTimeout The feature is opt-in and integrates automatically with connection pool eviction (client) and idle timeout handling (server). This implementation is based on PR #3612, reduces the scope and adds HttpClient support. Co-authored-by: raccoonback <[email protected]> Signed-off-by: Violeta Georgieva <[email protected]>
|
@raccoonback Would you be able to review #3980. I based it on this PR, reduced the scope and added HttpClient support. |
|
@violetagg Good! |
Introduce PING frame support for proactive connection health monitoring on idle HTTP/2 connections. The feature sends PING frames to detect unresponsive peers and close stale connections. Configuration via Http2SettingsSpec: - pingAckTimeout: Timeout for ACK response - pingAckDropThreshold: Maximum PING attempts (default: 1) Requires idle timeout configuration: - Client: ConnectionProvider.maxIdleTime - Server: HttpServer.idleTimeout The feature is opt-in and integrates automatically with connection pool eviction (client) and idle timeout handling (server). This implementation is based on PR #3612, reduces the scope and adds HttpClient support. Co-authored-by: raccoonback <[email protected]> Signed-off-by: Violeta Georgieva <[email protected]>
Description
In some cases, HTTP/2 connections may remain open even when they are no longer functional. By introducing a periodic Ping frame health check, we can proactively detect and close unhealthy connections.
The Http2ConnectionLivenessHandler schedules and sends Ping frames at a user-defined interval to verify the connection's liveness. If an acknowledgment (ACK) is not received within the specified time, the connection is considered unhealthy and is closed automatically.
However, if other frames are actively being sent or received, the scheduler does not send a Ping frame. This is because the server may delay ACK responses for various reasons. To prevent unnecessary connection termination, Ping frames are only sent when no read or write activity is detected.
Additionally, a configurable retry threshold for Ping frame transmission has been introduced. If a Ping frame fails to receive an ACK response, it will be retried up to the specified threshold before considering the connection unhealthy. This allows fine-tuning of the failure detection mechanism, balancing between aggressive failure detection and avoiding premature disconnections.
Scheduler Flow
Ping ACK Flow
Key Changes
Http2ConnectionLivenessHandlerhandler to check connection health with Ping frames at a configurable interval.Http2SettingsSpec.Related Issue