You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2020/07/07 07:43:44 UTC

[GitHub] [incubator-brpc] psylambda opened a new issue #1154: 支持设置tcp_user_timeout

psylambda opened a new issue #1154:
URL: https://github.com/apache/incubator-brpc/issues/1154


   **Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)**
   当server端宕机重启恢复后, client端要花较长时间才能成功连上server端。 同以下issue
   
   #1057 
   
   **Describe the solution you'd like (描述你期望的解决方法)**
   支持tcp_user_timeout, 提早断开连接。 
   目前[grpc已经支持](https://groups.google.com/forum/#!topic/grpc-io/6VZYCFZpyTI)
   
   **Describe alternatives you've considered (描述你想到的折衷方案)**
   
   
   **Additional context/screenshots (更多上下文/截图)**
   
   
   


----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] zyearn commented on issue #1154: 支持设置tcp_user_timeout

Posted by GitBox <gi...@apache.org>.
zyearn commented on issue #1154:
URL: https://github.com/apache/incubator-brpc/issues/1154#issuecomment-858067672


   这个需要通过brpc支持SO_KEEPALIVE来实现了。目前可以通过设置rpc超时时间来控制一下这个等待时间。


-- 
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] psylambda edited a comment on issue #1154: 支持设置tcp_user_timeout

Posted by GitBox <gi...@apache.org>.
psylambda edited a comment on issue #1154:
URL: https://github.com/apache/incubator-brpc/issues/1154#issuecomment-853546823


   场景是情况1, server端异常宕机/断电, client端的tcp包会一直重传, 且重传间隔越来越长, 如下图所示。
   ![image](https://user-images.githubusercontent.com/36839348/120583745-63ca3480-c461-11eb-9922-991084dd4301.png)
   
   在上图的例子中, client端在231秒和352秒分别发了一个重传包。 如果server端恰好在232秒恢复正常, 那么client端并不会立刻感知到, 而是在352秒时刻发重传包的时候才感知到, 并重新建tcp连接, 之后的请求才能正常被server端处理。  这意味着232秒到352秒时间内, 虽然server端恢复了, 但是client端的所有请求都持续报错。 
   
   
   * 对于grpc, 可以通过配置tcp_user_timeout, 来控制重传时间, 避免重传间隔过长导致server端恢复后, client端还要较长时间才能感知到
   * 对于brpc, 现在有办法避免这个问题么?
   
   @zyearn 
   
   
   
   


-- 
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] psylambda edited a comment on issue #1154: 支持设置tcp_user_timeout

Posted by GitBox <gi...@apache.org>.
psylambda edited a comment on issue #1154:
URL: https://github.com/apache/incubator-brpc/issues/1154#issuecomment-853546823


   场景是情况1, server端异常宕机/断电, client端的tcp包会一直重传, 且重传间隔越来越长, 如下图所示。
   ![image](https://user-images.githubusercontent.com/36839348/120583745-63ca3480-c461-11eb-9922-991084dd4301.png)
   
   在上图的例子中, client端在231秒和352秒分别发了一个重传包。 如果server端恰好在232秒恢复正常, 那么client端并不会立刻感知到, 而是在352秒时刻发重传包的时候才感知到, 并重新建tcp连接, 之后的请求才能正常被server端处理。  这意味着232秒到352秒时间内, 虽然server端恢复了, 但是client端的所有请求都持续报错。 
   
   
   * 对于grpc, 可以通过配置tcp_user_timeout, 来控制重传时间, 避免重传间隔过长导致server端恢复后, client端还要较长时间才能感知到
   * 对于brpc, 现在有办法避免这个问题么?
   
   @zyearn 
   
   
   
   


-- 
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] psylambda commented on issue #1154: 支持设置tcp_user_timeout

Posted by GitBox <gi...@apache.org>.
psylambda commented on issue #1154:
URL: https://github.com/apache/incubator-brpc/issues/1154#issuecomment-853546823


   场景是情况1, server端异常宕机/断电, client端的tcp包会一直重传, 且重传间隔越来越长, 如下图所示。
   ![image](https://user-images.githubusercontent.com/36839348/120583745-63ca3480-c461-11eb-9922-991084dd4301.png)
   
   在上图的例子中, client端在231秒和352秒分别发了一个重传包。 如果server端恰好在232秒恢复正常, 那么client端并不会立刻感知到, 而是在352秒时刻发重传包的时候才感知到, 并重新建tcp连接, 之后的请求才能正常被server端处理。  这意味着232秒到352秒时间内, 虽然server端恢复了, 但是client端的所有请求都持续报错。 
   
   
   * 对于grpc, 可以通过配置tcp_user_timeout, 来控制重传时间, 避免重传间隔过长导致server端恢复后, client端还要较长时间才能感知到
   * 对于brpc, 现在有办法避免这个问题么?
   
   
   
   


-- 
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] psylambda commented on issue #1154: 支持设置tcp_user_timeout

Posted by GitBox <gi...@apache.org>.
psylambda commented on issue #1154:
URL: https://github.com/apache/incubator-brpc/issues/1154#issuecomment-853546823


   场景是情况1, server端异常宕机/断电, client端的tcp包会一直重传, 且重传间隔越来越长, 如下图所示。
   ![image](https://user-images.githubusercontent.com/36839348/120583745-63ca3480-c461-11eb-9922-991084dd4301.png)
   
   在上图的例子中, client端在231秒和352秒分别发了一个重传包。 如果server端恰好在232秒恢复正常, 那么client端并不会立刻感知到, 而是在352秒时刻发重传包的时候才感知到, 并重新建tcp连接, 之后的请求才能正常被server端处理。  这意味着232秒到352秒时间内, 虽然server端恢复了, 但是client端的所有请求都持续报错。 
   
   
   * 对于grpc, 可以通过配置tcp_user_timeout, 来控制重传时间, 避免重传间隔过长导致server端恢复后, client端还要较长时间才能感知到
   * 对于brpc, 现在有办法避免这个问题么?
   
   
   
   


-- 
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] zyearn commented on issue #1154: 支持设置tcp_user_timeout

Posted by GitBox <gi...@apache.org>.
zyearn commented on issue #1154:
URL: https://github.com/apache/incubator-brpc/issues/1154#issuecomment-656691854


   这里有两种情况:
   1. 对端出现异常断网/掉电,client端的tcp连接无法感知(可以通过加SO_KEEPALIVE解决),这时如果server不启动,client就会持续发流量,当server一恢复,client就会收到“Connection reset by peer”,然后下一次rpc会重新建tcp连接。
   2. 对端正常重启,client端会直接关闭掉当前的socket,下一次rpc也会重建连接。
   
   在上述两个情况下,都会新建tcp连接,所以你描述的“因tcp重传的backoff机制,导致server端恢复110秒后, client端才请求成功“听起来是一直在用同一个tcp连接,但这似乎不会发生,可以具体描述一下导致你下这一结论的数据/现象么


----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] gydong commented on issue #1154: 支持设置tcp_user_timeout

Posted by GitBox <gi...@apache.org>.
gydong commented on issue #1154:
URL: https://github.com/apache/incubator-brpc/issues/1154#issuecomment-655858507


   可以开启一下熔断功能,时间就变成可控的了


----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] psylambda commented on issue #1154: 支持设置tcp_user_timeout

Posted by GitBox <gi...@apache.org>.
psylambda commented on issue #1154:
URL: https://github.com/apache/incubator-brpc/issues/1154#issuecomment-656628488


   > 可以开启一下熔断功能,时间就变成可控的了
   
   熔断功能确实可以控制断开连接的时间, 但参数太多太复杂了。tcp_user_timeout相对而言容易理解很多。


----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org