You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/04/25 08:46:44 UTC

[GitHub] [dubbo] wangchengming666 opened a new pull request, #9968: [3.0 Triple] Support HTTP2 connection Keepalive

wangchengming666 opened a new pull request, #9968:
URL: https://github.com/apache/dubbo/pull/9968

   ## What is the purpose of the change
   Support HTTP2 connection Keepalive. 
   - When connection have not any active stream will schedule to send ping frame to keep connection alive. 
   - It would close the connection when it have not received ping ack timeout.
   - The value of the scheduled task use `UrlUtils.getHeartbeat(getUrl())`
   
   
   ## Brief changelog
   
   
   ## Verifying this change
   
   
   <!-- Follow this checklist to help us incorporate your contribution quickly and easily: -->
   
   ## Checklist
   - [x] Make sure there is a [GitHub_issue](https://github.com/apache/dubbo/issues) field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
   - [ ] Each commit in the pull request should have a meaningful subject line and body.
   - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [ ] Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
   - [ ] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in [dubbo samples](https://github.com/apache/dubbo-samples) project.
   - [ ] Add some description to [dubbo-website](https://github.com/apache/dubbo-website) project if you are requesting to add a feature.
   - [ ] GitHub Actions works fine on your own branch.
   - [ ] If this contribution is large, please follow the [Software Donation Guide](https://github.com/apache/dubbo/wiki/Software-donation-guide).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] codecov-commenter commented on pull request #9968: [3.0 Triple] Support HTTP2 connection Keepalive

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #9968:
URL: https://github.com/apache/dubbo/pull/9968#issuecomment-1108312049

   # [Codecov](https://codecov.io/gh/apache/dubbo/pull/9968?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#9968](https://codecov.io/gh/apache/dubbo/pull/9968?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (27a8c58) into [3.0](https://codecov.io/gh/apache/dubbo/commit/5aa660ce1d5e4663494f0fddc15544369a22c93e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5aa660c) will **decrease** coverage by `0.30%`.
   > The diff coverage is `28.57%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##                3.0    #9968      +/-   ##
   ============================================
   - Coverage     65.74%   65.43%   -0.31%     
   + Complexity      320      319       -1     
   ============================================
     Files          1215     1215              
     Lines         53030    53021       -9     
     Branches       8032     8009      -23     
   ============================================
   - Hits          34865    34696     -169     
   - Misses        14364    14502     +138     
   - Partials       3801     3823      +22     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo/pull/9968?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...he/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java](https://codecov.io/gh/apache/dubbo/pull/9968/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy10cmlwbGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JwYy9wcm90b2NvbC90cmkvVHJpcGxlSHR0cDJQcm90b2NvbC5qYXZh) | `87.50% <ø> (ø)` | |
   | [...l/tri/transport/TripleServerConnectionHandler.java](https://codecov.io/gh/apache/dubbo/pull/9968/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy10cmlwbGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JwYy9wcm90b2NvbC90cmkvdHJhbnNwb3J0L1RyaXBsZVNlcnZlckNvbm5lY3Rpb25IYW5kbGVyLmphdmE=) | `48.57% <0.00%> (-4.56%)` | :arrow_down: |
   | [...pc/protocol/tri/transport/TripleClientHandler.java](https://codecov.io/gh/apache/dubbo/pull/9968/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy10cmlwbGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JwYy9wcm90b2NvbC90cmkvdHJhbnNwb3J0L1RyaXBsZUNsaWVudEhhbmRsZXIuamF2YQ==) | `26.08% <25.00%> (-11.42%)` | :arrow_down: |
   | [...java/org/apache/dubbo/remoting/api/Connection.java](https://codecov.io/gh/apache/dubbo/pull/9968/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy9hcGkvQ29ubmVjdGlvbi5qYXZh) | `69.10% <100.00%> (-1.39%)` | :arrow_down: |
   | [...dubbo/remoting/zookeeper/ZookeeperTransporter.java](https://codecov.io/gh/apache/dubbo/pull/9968/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy96b29rZWVwZXIvWm9va2VlcGVyVHJhbnNwb3J0ZXIuamF2YQ==) | `55.55% <0.00%> (-33.34%)` | :arrow_down: |
   | [...ng/zookeeper/curator5/Curator5ZookeeperClient.java](https://codecov.io/gh/apache/dubbo/pull/9968/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3Rpbmctem9va2VlcGVyLWN1cmF0b3I1L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy96b29rZWVwZXIvY3VyYXRvcjUvQ3VyYXRvcjVab29rZWVwZXJDbGllbnQuamF2YQ==) | `43.47% <0.00%> (-27.06%)` | :arrow_down: |
   | [.../remoting/api/SingleProtocolConnectionManager.java](https://codecov.io/gh/apache/dubbo/pull/9968/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy9hcGkvU2luZ2xlUHJvdG9jb2xDb25uZWN0aW9uTWFuYWdlci5qYXZh) | `61.53% <0.00%> (-23.08%)` | :arrow_down: |
   | [...nt/metadata/ServiceInstanceHostPortCustomizer.java](https://codecov.io/gh/apache/dubbo/pull/9968/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVnaXN0cnkvZHViYm8tcmVnaXN0cnktYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZWdpc3RyeS9jbGllbnQvbWV0YWRhdGEvU2VydmljZUluc3RhbmNlSG9zdFBvcnRDdXN0b21pemVyLmphdmE=) | `65.78% <0.00%> (-21.06%)` | :arrow_down: |
   | [...ache/dubbo/remoting/transport/AbstractChannel.java](https://codecov.io/gh/apache/dubbo/pull/9968/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy90cmFuc3BvcnQvQWJzdHJhY3RDaGFubmVsLmphdmE=) | `75.00% <0.00%> (-12.50%)` | :arrow_down: |
   | [...in/java/org/apache/dubbo/common/utils/JVMUtil.java](https://codecov.io/gh/apache/dubbo/pull/9968/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vdXRpbHMvSlZNVXRpbC5qYXZh) | `79.59% <0.00%> (-12.25%)` | :arrow_down: |
   | ... and [59 more](https://codecov.io/gh/apache/dubbo/pull/9968/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo/pull/9968?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo/pull/9968?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5aa660c...27a8c58](https://codecov.io/gh/apache/dubbo/pull/9968?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] guohao commented on a diff in pull request #9968: [3.0 Triple] Support HTTP2 connection Keepalive

Posted by GitBox <gi...@apache.org>.
guohao commented on code in PR #9968:
URL: https://github.com/apache/dubbo/pull/9968#discussion_r857434838


##########
dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleClientHandler.java:
##########
@@ -22,23 +22,60 @@
 
 import io.netty.channel.ChannelDuplexHandler;
 import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.http2.DefaultHttp2PingFrame;
+import io.netty.handler.codec.http2.Http2FrameCodec;
 import io.netty.handler.codec.http2.Http2GoAwayFrame;
+import io.netty.handler.codec.http2.Http2PingFrame;
 import io.netty.util.ReferenceCountUtil;
 
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
 public class TripleClientHandler extends ChannelDuplexHandler {
 
+    static final long CLIENT_SCHEDULE_PING = 0x1141a85a98L;
+
     private final FrameworkModel frameworkModel;
 
-    public TripleClientHandler(FrameworkModel frameworkModel) {
+    private Http2FrameCodec codec;
+
+    private ScheduledExecutorService pingExecutor;
+
+    private int heartbeatInterval;
+
+    private int lossConnectCount = 0;
+
+    public TripleClientHandler(FrameworkModel frameworkModel, Http2FrameCodec codec,
+                               int heartbeatInterval) {
         this.frameworkModel = frameworkModel;
+        this.codec = codec;
+        this.heartbeatInterval = heartbeatInterval;
     }
 
     @Override
     public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
+        lossConnectCount = 0;
         if (msg instanceof Http2GoAwayFrame) {
             final ConnectionHandler connectionHandler = ctx.pipeline().get(ConnectionHandler.class);
             connectionHandler.onGoAway(ctx.channel());
         }
         ReferenceCountUtil.release(msg);
     }
+
+    @Override
+    public void channelActive(ChannelHandlerContext ctx) {
+
+        pingExecutor.schedule(() -> {
+            if (codec.connection().numActiveStreams() <= 0 && lossConnectCount > 2) {

Review Comment:
   The `schedule` may lead to too many ping tasks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org