gRPC在Golang中的故障检测

huangapple go评论93阅读模式
英文:

gRPC failure detection in Golang

问题

我正在尝试使用https://pkg.go.dev/google.golang.org/grpc#ClientConn.WaitForStateChange函数来实现故障检测机制。我注意到当我停止服务器时,gRPC连接的状态从READY变为IDLE。然而,我期望它会转换为TransientFailure状态。我还尝试设置保持活动参数,但似乎行为没有改变。有什么想法是什么原因导致这种行为?

请注意,如果在服务器关闭后进行调用,我将看到TransientFailure状态的变化,否则我只会看到IDLE状态。

英文:

I am trying to use https://pkg.go.dev/google.golang.org/grpc#ClientConn.WaitForStateChange function to implement a failure detection mechanism. I noticed when I stop the server the state of the gRPC connection goes from READY to IDLE. However, I expect it goes to TransientFailure state. I also tried to set keep alive parameters but it doesn't seem there is a change in that behavior. Any ideas what could causing this behavior?

Consider that If I make a call after the server down, I will see TransientFailure state change otherwise what I see is just IDLE state.

答案1

得分: 0

IDLE是正确的下一个状态。如果发送了任何新的RPC请求,客户端将尝试连接,此时它将进入CONNECTING状态,然后是TRANSIENT_FAILURE状态。

英文:

IDLE is the correct next state, here. If any new RPCs are sent, the client will attempt to connect, at which point it will go to CONNECTING and then TRANSIENT_FAILURE.

huangapple
  • 本文由 发表于 2021年11月29日 03:08:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/70146602.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定