-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spanner: Ensure client backoff is implemented to respect client configuration. #2062
Comments
@crwilcox, @dwsupplee, I believe this feature is already implemented in here and testing here, so, I think, this issue could be closed |
Apparently all gRPC requests are handled by |
I found that requested feature is implemented (and gapic configuration is respected), but for some reason it is disabled by default. All gRPC methods (except for Requests are handled with Google\Cloud\Core\GrpcRequestWrapper#send() method. This method intentionally disables gapic backoffs (setting This behaviour can be overridden by passing gRPC retry settings (may be an empty array) to $options = [
'grpcOptions' => [
'retrySettings' => [],
],
];
$spanner = new SpannerClient($options);
// gapic backoffs will be used Works fine, but looks messy. Better solution is using this trick in |
@ava12 thanks for this interesting finding. @dwsupplee do you know of the history of why reading the gapic configuration for client backoff settings is disabled by default in PHP? Is there another way to enable it than the way @ava12 suggested? Thanks for your help. |
@skuruppu Yes, I have some context. Story time! Originally when this repository started we were building custom clients around some of our biggest services, like Storage, BigQuery, and PubSub. We built these clients to use HTTP 1.1 and a generic retry strategy which was recommended at the time. As time went on, generated clients (GAPICs) started to come into the picture. These clients introduced a more granular approach to retry mechanisms as well as support for gRPC. Our goal was to help keep things simple for users and prevent the need for breaking changes. As such, we opted for keeping the original retry mechanisms we had in place for our original HTTP 1.1 clients and to abstract the concept of gRPC away under the hood. As found here, we allowed the ability to still have granular control over the gRPC retry mechanisms, but it is a bit hidden. To answer your question about another way to enable the retry mechanisms, at the moment - no. But as we've discussed before - we are in the planning stages for a "2.0" version of this library which will help simplify concepts across the board and reduce the need for some of these legacy solutions we've built up over the years. |
Wow, cool, thanks for the context @dwsupplee. I would personally be happy to go with the solution where the options are set inside the constructor (keeping in mind that users can override these) so that users don't have to apply the trick themselves. @dwsupplee would this be considered a breaking change? Would it be better for us to wait for "2.0" instead? |
If we make this change in the I am in the camp that leans towards waiting for 2.0, but do understand the need for flexibility here. What if we kept defaulting to what I'll refer to as the "legacy" retry mechanism, but exposed a flag in the constructor which makes it easy to opt in to using the strategy exposed by the GAPICs? This could allow us to introduce a clean (and clearly documented) way for users to opt-in to using the more granular retry strategy without needing to force everyone in to the change. Let me know what you think. |
I think that's a reasonable compromise. Thanks for the suggestion. @ava12, would you be able to implement @dwsupplee's suggestion? |
Adding a flag to |
* feat(spanner): add option to use GAPIC backoff strategy (#2062) * chore: GAPIC backoffs refactor: get rid of Reflection test: new flag does not interfere with custom gRPC options * chore: code style fixes * chore: skip gRPC tests * refactor: GAPIC backoff option - rename useGapicBackoffs -> useDiscreteBackoffs - disable legacy retries when GAPIC backoffs used * chore: add copyright notice
@dwsupplee Is there a timeline for the "2.0" version of this library? Does "this library" mean the whole PHP library or just Cloud Spanner PHP? Is there anything the Spanner team can do? We're working on making all the Spanner client libraries consistent in regards to retries and timeouts. |
@dwsupplee I just would like to follow up with @larkee's questions in the previous message. If you get a chance, could you please reply to them? Thanks. |
We would be looking to do a major bump across all our libraries, with a rough date of Q3/Q4. Part of this will be removing the portions of the connection layer that currently act as an intermediary between the GAPICs and veneer surface, meaning the GAPIC retries will become the default. Does that seem to suite you and the team? |
Yes, sounds good. Our team just wants to know the timeline. Thanks a lot for the update. |
There was an issue in the client library for python where requests to retry could occur without a proper retry object. In this case, rather than defaulting to an exponential backoff, we defaulted to immediate retry. Ensure that for this client library we respect the min, max, and multiplier as specified in the gapic configuration.
Original Bug: googleapis/google-cloud-python#7303
The text was updated successfully, but these errors were encountered: