问题描述
我们正在尝试在 grpc 中实现客户端负载平衡。我有用 .NET Core 3.1 编写的服务器和用 JS 编写的客户端,两个组件部署在 GKE 中。
在客户端中,配置没问题,我测试并成功执行负载平衡任务,但我注意到它无法识别服务器的新副本。
我在文档中读到 gRPC 服务器需要发送“GOAWAY”信号以便让客户端查找副本(通过 DNS.lookup)我在 .NET 2.0 上的 GRPC.Core 中找到了一个示例,即工作,他们用几个通道选项定义了服务器,特别是 grpc.max_connection_age_ms 和 grpc.max_connection_age_grace_ms
/ Work around to make round_robin LB policy re-resolve backends periodically and thus pick up newly deployed replicas of the service.
// see https://github.com/grpc/proposal/blob/master/A9-server-side-conn-mgt.md
var serverArgs = new[] {new ChannelOption("grpc.max_connection_age_ms",5000),new ChannelOption("grpc.max_connection_age_grace_ms",3000)};
Server server = new Server(serverArgs)
{
Services = { Greeter.BindService(new GreeterImpl()) },Ports = { new ServerPort("0.0.0.0",Port,ServerCredentials.Insecure) },};
server.Start();
Console.WriteLine("Started server on port " + Port);
// wait forever
server.ShutdownTask.Wait();`
我们需要做同样的事情,但在 Krestel 中,我已经阅读了文档并且我一直试图找到一个例子,但不是运气。
谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)