英文:
What is the difference between grpc.WithConnectParams.Backoff and grpc_retry.WithBackoff?
问题
我正在尝试理解两种GRPC重试的方式之间的区别。
一种是grpc.WithConnectParams,例如:
grpc.Dial(address, grpc.WithConnectParams(grpc.ConnectParams{
Backoff: backoff.Config{
BaseDelay: 1 * time.Second,
Multiplier: 1.6,
MaxDelay: 15 * time.Second,
},
}))
另一种是:
grpc.Dial(address, []grpc_retry.CallOption{
grpc_retry.WithMax(4),
grpc_retry.WithBackoff(grpc_retry.BackoffExponential(1 * time.Second)),
})
第一种方式的文档在这里:
https://pkg.go.dev/google.golang.org/grpc/backoff
另一种方式的文档在这里:
https://pkg.go.dev/github.com/grpc-ecosystem/go-grpc-middleware/retry
它们似乎做着相同的事情...?我不太确定。
英文:
I am trying to understand what is the difference between two GRPC ways to do a retry.
One is grpc.WithConnectParams; that is, let's say
grpc.Dial(address, grpc.WithConnectParams(grpc.ConnectParams{
Backoff: backoff.Config{
BaseDelay: 1 * time.Second,
Multiplier: 1.6,
MaxDelay: 15*time.Second,
}))
vs
grpc.Dial(address, []grpc_retry.CallOption{
grpc_retry.WithMax(4),
grpc_retry.WithBackoff(grpc_retry.BackoffExponential(1*time.Second)),
})
The first one is documented here
https://pkg.go.dev/google.golang.org/grpc/backoff
The other is documented here
https://pkg.go.dev/github.com/grpc-ecosystem/go-grpc-middleware/retry
They seem like doing the same thing...? I am not exactly sure
答案1
得分: 0
grpc.WithConnectParams.Backoff
在“低级别”上进行重试,即连接级别;而grpc_retry.CallOption
在请求级别上进行重试。
英文:
grpc.WithConnectParams.Backoff
does retries on the "low level" - the connection level; while grpc_retry.CallOption
does retries on the request level.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论