Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions docs/specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ Here is a sample Go code to illustrate:
if err != nil {
log.Fatal(err)
}

return st.Err()
```

Expand Down Expand Up @@ -314,8 +313,14 @@ error with code [Unavailable](https://godoc.org/google.golang.org/grpc/codes)
and MAY supply additional
[details via status](https://godoc.org/google.golang.org/grpc/status#Status.WithDetails)
using
[RetryInfo](https://github.com/googleapis/googleapis/blob/6a8c7914d1b79bd832b5157a09a9332e8cbd16d4/google/rpc/error_details.proto#L40).
Here is a snippet of sample Go code to illustrate:
[RetryInfo](https://github.com/googleapis/googleapis/blob/6a8c7914d1b79bd832b5157a09a9332e8cbd16d4/google/rpc/error_details.proto#L40)
or via Trailer [with the gRPC metadata key `grpc-retry-pushback-ms`](https://github.com/grpc/proposal/blob/master/A6-client-retries.md#pushback).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please link to a permanent link instead of one that can break.


The client SHOULD honor at least one of these backpressure mechanisms.
Copy link
Member

@tigrannajaryan tigrannajaryan Aug 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens with the clients that honor the new mechanism that attempt to work with a server that honors only the old mechanism (existing implementations)? They would be incompatible, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below it's recommended below for the server to implement both mechanisms, then the client is guaranteed to respect it..

Right now clients are split between the 2 mechanisms, that's the current state, the server needs to do both if it wants a guarantee.

Alternatively lets just recommend the retry - config mechanism in all cases for everyone ? Since the clients are already split, it's likely that server's timeouts aren't being respected in all cases. If a retry-timeout isn't respected it's not that bad anyway, as all the clients have their own back off timeout logic already.


In order to have the backpressure respected, the server SHOULD implement both mechanisms.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean the server should be responding with both mechanisms at the same time? The example below only has one mechanism being used at a time.

This seems odd to me. It is usually the client that is recommended to handle multiple versions of a response and the server is expected to support at least one.

Is there a preference for which mechanism the server should support?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is a preference. About half the languages are using gRPC retry config which supports only the pushback-ms header, and the other half is rolling their own retry logic and only support the RetryInfo..

If a client uses gRPC retry config, it is offloading all the retry logic to gRPC internal library, so it can't also support RetryInfo.


Here is a snippet of sample Go code to illustrate using `RetryInfo`:

```go
// Do this on the server side.
Expand All @@ -341,28 +346,23 @@ Here is a snippet of sample Go code to illustrate:
}
```

When the client receives this signal, it SHOULD follow the recommendations
outlined in documentation for
[RetryInfo](https://github.com/googleapis/googleapis/blob/6a8c7914d1b79bd832b5157a09a9332e8cbd16d4/google/rpc/error_details.proto#L40):
Here is a snippet of sample Go code to illustrate using `grpc-retry-pushback-ms`:

```go
// Do this on the server side.
trailer := metadata.Pairs("grpc-retry-pushback-ms", "5000")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this expected to be done only if the server wants to pushback? It is not clear from the sample if this is some sort of permanent option that the server must always set or only set when the server is overloaded and needs to pushback the clients.

grpc.SetTrailer(ctx, trailer)
```
// Describes when the clients can retry a failed request. Clients could ignore
// the recommendation here or retry when this information is missing from the error
// responses.
//
// It's always recommended that clients should use exponential backoff when
// retrying.
//
// Clients should wait until `retry_delay` amount of time has passed since
// receiving the error response before retrying. If retrying requests also
// fail, clients should use an exponential backoff scheme to increase gradually
// the delay between retries based on `retry_delay` until either a maximum
// number of retries has been reached, or a maximum retry delay cap has been
// reached.
```

The value of `retry_delay` is determined by the server and is implementation
dependant. The server SHOULD choose a `retry_delay` value that is big enough to
On the client side using [gRPC retry config](https://grpc.io/docs/guides/retry)
will cause the gRPC client to automatically parse the `grpc-retry-pushback-ms`
trailer metadata and handle all backoff and retry logic.

The description of how the client should respect `RetryInfo` is provided
in its [documentation](https://github.com/googleapis/googleapis/blob/6a8c7914d1b79bd832b5157a09a9332e8cbd16d4/google/rpc/error_details.proto#L34-L39).

The value of `retry_delay`/`grpc-retry-pushback-ms` is determined by the server and is implementation
dependant. The server SHOULD choose a `retry_delay`/`grpc-retry-pushback-ms` value that is big enough to
give the server time to recover yet is not too big to cause the client to drop
data while being throttled.

Expand Down