core icon indicating copy to clipboard operation
core copied to clipboard

gRPC apps can make resilient API calls with client retry support

Open JamesNK opened this issue 5 years ago • 8 comments

Automatically retrying some failed API calls (i.e. connection failure, transient server error) is a common task in apps. Polly is an OSS library often used to support retries with RESTful APIs. Unfortunately Polly doesn't work with gRPC.

There is a gRPC specification for retrying failed calls - https://github.com/grpc/proposal/blob/master/A6-client-retries.md

The spec is implemented by the two first-class gRPC implementations: grpc-go and grpc-java. It is partially implemented by ccore and its related bindings (C++, PHP, Python, C#). There is currently no retry support in grpc-dotnet.

Reasons to do:

  • To maintain feature parity with other first-class gRPC implementations
  • Support apps that need retry functionality to be resilient
  • First-party customer demand

Dev features/work:

  • [x] Add API to get RST_STREAM value from HTTP exceptions - https://github.com/dotnet/runtime/issues/43239
  • [x] Add support for retries to gRPC client library - https://github.com/grpc/grpc-dotnet/issues/1189
  • [x] gRPC client update to read protocol error from new .NET 6 exceptions - https://github.com/grpc/grpc-dotnet/issues/1241

JamesNK avatar Oct 29 '20 21:10 JamesNK

What epic should this be listed under?

terrajobst avatar Oct 31 '20 08:10 terrajobst

@JamesNK any requirements on the client networking stack here?

danmoseley avatar Nov 03 '20 23:11 danmoseley

What epic should this be listed under?

It was under cloud native. @richlander removed it. What was the reason behind that?

JamesNK avatar Nov 04 '20 22:11 JamesNK

@JamesNK any requirements on the client networking stack here?

Maybe. I will need to do some investigation then talk to client team

JamesNK avatar Nov 04 '20 22:11 JamesNK

OK, please let us know if there are. cc @karelz

danmoseley avatar Nov 04 '20 22:11 danmoseley

@glennc should this be parented somewhere in the Cloud Native Theme?

Pilchie avatar Nov 16 '20 18:11 Pilchie

This is done now, right @JamesNK ?

Pilchie avatar Jan 12 '22 21:01 Pilchie

Done! https://docs.microsoft.com/en-us/aspnet/core/grpc/retries?view=aspnetcore-6.0

A feature wasn't added in HttpClient, which is why some issues aren't closed, but I worked around it.

JamesNK avatar Jan 12 '22 22:01 JamesNK

Bulk closing .NET 6 epics and user stories. If you think this issue was closed in error, please reopen the issue and update it accordingly.

mairaw avatar May 26 '23 19:05 mairaw