wangtuanjie commented on issue #1154:
URL: https://github.com/apache/brpc/issues/1154#issuecomment-1820204495

   > 这个需要通过brpc支持SO_KEEPALIVE来实现了。目前可以通过设置rpc超时时间来控制一下这个等待时间。
   
   ---------------
   
[有赞TCP网络编程最佳实践](https://tech.youzan.com/you-zan-tcpwang-luo-bian-cheng-zui-jia-shi-jian/)
   
   > 如果TCP发送缓冲区中有数据未发送成功,TCP会进行超时重传,而不会触发TCP Keepalive。也就是说,即使应用设置了很小的TCP 
Keepalive参数,如time=10s、interval=10s、probes=3,在net.ipv4.tcp_retries2默认配置下,可能还是一直等到15min左右才能感知到网络异常。可能有的人不理解为什么Keepalive会被重传干扰,其实这里就是个优先级的问题。TCP最大重传次数的作用高于Keepalive参数的作用,未达到最大重传次数,不会向应用层报告网络错误信息。如果Keepalive不受重传影响,同样也会对关注重传的人造成干扰,比如为什么还没达到最大重传次数就放弃重传并关闭连接了?我们可以通过netstat
 -ot或ss -ot命令查看当前连接的计时器信息。
   
   这种场景如果主动设置了`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.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

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


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

Reply via email to