Does gRPC retry mechanism work and if so, where am I wrong?
See original GitHub issueWhat version of gRPC are you using?
1.20
What did you expect to see?
I’m trying to figure out how to set up custom retry mechanism. After looking at A6-client-retries and searching through github/google I didn’t find any real examples/explanations. So I think that I missed some notable thing.
So, I try to create a client connection with a retry mechanism. Like:
Map<String, Object> retryPolicy = new HashMap<>();
retryPolicy.put("maxAttempts", 5D);
retryPolicy.put("initialBackoff", "10s");
retryPolicy.put("maxBackoff", "30s");
retryPolicy.put("backoffMultiplier", 2D);
retryPolicy.put("retryableStatusCodes", Arrays.<Object>asList("UNAVAILABLE", "UNAUTHENTICATED"));
Map<String, Object> methodConfig = new HashMap<>();
Map<String, Object> name = new HashMap<>();
name.put("service", "client");
methodConfig.put("name", Collections.<Object>singletonList(name));
methodConfig.put("retryPolicy", retryPolicy);
Map<String, Object> serviceConfig = new HashMap<>();
serviceConfig.put("methodConfig", Collections.<Object>singletonList(methodConfig));
final NettyChannelBuilder channelBuilder = NettyChannelBuilder
.forAddress(host, port)
.enableRetry()
.defaultServiceConfig(serviceConfig)
.intercept(authInterceptor);
And client behavior doesn’t change. Could anybody get me an advice/example or move me in the right direction?
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Transient fault handling with gRPC retries - Microsoft Learn
Configures a retry policy. This policy instructs clients to automatically retry gRPC calls that fail with the status code Unavailable . ...
Read more >gRPC A6: Retries - Google Groups
The retry attempt or hedged RPC will be re-resolved through the load-balancer, so it's up to the service owner to ensure that this...
Read more >grpc/grpc - Gitter
I'm trying to write a grpc-java client that can store failed/canceled ... If I had a retry mechanism I think it would solve...
Read more >RPC semantics of gRPC - Stack Overflow
gRPC provides at-most-once guarantee by default. Things like retries and similar can change that, but they are opt-in.
Read more >Migration to gRPC client - EventStoreDB Documentation
The gRPC client handles reconnections internally. But contrary to the TCP client, it does not have built-in retries for failed operations. It ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dshylov
You service name still does not look right. It should be the full name of the service, which is
PROTO_FILENAME.SERVICE_NAME
. For example, for thehelloworld
example, it should behelloworld.Greeter
. I’ve tried with your retry config, it worked for me by using thehelloworld
example.Thanks for the explanation @voidzcy I will close this issue since the original problem was resolved.