Bootstrap

keepalive 理解

发送信息到目的ip失效(对端服务器或者POD挂了),SYN 重试到TIMEOUT

  1. 内核参数TCP_SYNCNT
  2. Go grpc 设置withblock会一直阻塞,不设置withbloack每20s重试一次(20s是默认值)

发送信息到已经建连连接,TCP 重试到TIMEOUT

  1. 内核参数tcp_retries2
  2. keepalive可以起作用,内核tcp参数net.ipv4.tcp_keepalive_intvl,net.ipv4.tcp_keepalive_probes,net.ipv4.tcp_keepalive_time
  3. go grpc keepalive 会导致 tcp grpc keepalive失效,go grpc keepalive 会发包,并且本质上也是设置了TCP_USER_TIMEOUT
  4. 理论上用户层如果会去做探测到话,可以不使用go keepalive和tcp keepalive,设置TCP_USER_TIMEOUT即可

参考链接:https://www.evanjones.ca/tcp-connection-timeouts.html

;