简体   繁体   English

在 C# 中使用 gRPC 子通道进行负载平衡

[英]Load balancing with gRPC subchannels in C#

I'd like to do simple client side load balancing for grpc as described here .我想为 grpc 做简单的客户端负载平衡,如此处 所述

I'm using Microsoft Azure Service Fabric so getting a list of the available endpoints is trivial, but I can't find an API to add sub-channels to the C# Channel class.我正在使用 Microsoft Azure Service Fabric,因此获取可用端点的列表很简单,但我找不到将子通道添加到 C# Channel类的 API。 Is adding sub-channels possible with the C# client?是否可以使用 C# 客户端添加子频道? If not what would be the best solution for implementing this.如果不是,那么实现这一点的最佳解决方案是什么。

If you set如果你设置

channelOptions.Add(new ChannelOption("grpc.lb_policy_name", "round_robin"));

the GRPC C# client will automatically open subchannels for each A record that's resolved by the DNS request, and will route across them appropriately. GRPC C# 客户端将自动为 DNS 请求解析的每个 A 记录打开子通道,并将适当地通过它们进行路由。

A good example of GRPC loadbalancing in C# (although for Kubernetes, not service fabric) is this example repo from Jan Tattermusch's Kubecon talk a few years ago. C# 中 GRPC 负载平衡的一个很好的例子(虽然是针对 Kubernetes,而不是服务结构)是几年前 Jan Tattermusch 的 Kubecon 演讲中的示例存储库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM