Is it possible to implement gRPC client sharding on balancer level?
Let's say I want to shard my requests to service foosvc
, which I name resolve beforehand to 3 servers (foosvc1
, foosvc2
, foosvc3
) and I want client1
to always connect to server foosvc1
, client2
to foosvc2
, etc. I tried creating a custom balancer, but I do not see any way to access the request's metadata inside of the balancer.
Can I create a custom balancer (base on the balancer package) to do this or do I need to have multiple grpc clients and solve this in my calling logic? Or perhaps this is some sort of anti-pattern and there is a better solution?