Open vrnmthr opened 8 months ago
I found https://github.com/grpc/grpc-dotnet/blob/master/test/FunctionalTests/Balancer/LeastUsedBalancer.cs. @JamesNK is there a reason this is not exposed publicly?
Because it was just an experiment. It also isn't perfect. It doesn't properly track long running streams. It only tracks calls until they return the first message.
@JamesNK Are there any plans to make public implementation?
It would be helpful, for instance, in kubenetes envinronment when cpu requests != limits (QoS=Burstable
) to distribute load according to real resouses avalability of each pod in the k8s deployment.
With round-robin strategy pod that actually has lower resources handles requests slower and thus has more connections stick to it in particular moment of time.
No plans.
I understand that we can create a custom load balancer as per https://learn.microsoft.com/en-us/aspnet/core/grpc/loadbalancing?view=aspnetcore-5.0#create-a-custom-load-balancer.
I want to create a load balancer that sends requests to the endpoint with the least number of currently active connections. With the
SubchannelsLoadBalancer
, I can always know when I am "picking" a given subchannel (and thus I can increment its connection count). Is there any hook that I can call when a given request is completed (so I can decrement connection count)?I am sure that this type of load balancing will be useful for many people. Perhaps it is worth adding into the library as an out of the box configurable option.