Hi,
I have a preferred and a fallback grpc server and I need a load balancer at
client which sends messages to the preferred server until the connection
breaks with it. After that the client should choose the fallback server
until the reconnection will be successful with the preferred server.
For this purpose I think the priority load balancer would be the best
option.
I create a service config json string like this:
string service_config = R"({
"loadBalancingConfig": [ {
"priority_experimental": {
"children": {
"high_priority": {
"config": [
{"round_robin": {}}
]
},
"low_priority": {
"config": [
{"round_robin": {}}
]
}
},
"priorities": ["high_priority", "low_priority"]
}
} ]
} )";
I set the service config in the *ChannelArgument* object:
arguments.SetServiceConfigJSON(service_config);
Finally I create a channel:
std::shared_ptr<grpc::Channel> channel = grpc::CreateCustomChannel(host +
":" + to_string(port), grpc::InsecureChannelCredentials(), arguments);
I am watching grpc trace logs during running and I have noticed this
failure:
I0828 09:51:58.415278637 12579 priority.cc:765] [priority_lb
0x608845e62a90]
child high_priority (0x608845e61d30): state update: TRANSIENT_FAILURE
(UNAVAILABLE: empty address list: ) picker 0x608845e65f40
I figured out that the dns resolver returns 2 addresses but they would not
be added to the high and low priorities because in
*MakeHierarchicalAddressMap* method called from *PriorityLb::UpdateLocked *in
priority.cc tries to get an attribute from address object with a "
*hierarchical_path*" key. The resolved does not add an attribute like this.
My question is that how can I add this path attribute to the resolver to be
able to assign the resolved addresses to the given priorities? An example
of how to use the priority load balancer correctly would be nice of course.
I use grpc C++ version 1.51.1. The result is the same with python 1.64.1 so
I think it is not a version problem, I am missing something.
Regards,
Adam
--
You received this message because you are subscribed to the Google Groups
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/cc9ad63d-d759-4c15-a66b-97b576d86ec0n%40googlegroups.com.