Skip to content
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

feat: adds clientside retries #66

Closed
wants to merge 5 commits into from

Conversation

eaddingtonwhite
Copy link
Member

Closes #44
Closes #49

Copy link
Collaborator

@cprice404 cprice404 left a comment

Choose a reason for hiding this comment

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

handful of thoughts / questions about consistency with other languages, plus need to make sure we have a story around non-idempotent request types

RetryStrategy: NewStaticRetryStrategy(&RetryStrategyProps{
RetryableRequestStatuses: defaultRetryableStatusCodes,
MaxRetries: defaultMaxRetries,
PerRetryTimeout: overallRequestTimeout / defaultMaxRetries,
Copy link
Collaborator

Choose a reason for hiding this comment

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

idk if we want to introduce this yet? it's a little different from the other sdks, was just planning on sticking to the most basic FixedCount strategy for now and circling back later.

}

type RetryStrategy interface {
// GetRetryableRequestStatuses Which status codes to retry requests on
Copy link
Collaborator

Choose a reason for hiding this comment

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


type RetryStrategyProps struct {
// Which status codes to retry requests on
RetryableRequestStatuses []codes.Code
Copy link
Collaborator

Choose a reason for hiding this comment

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

you might want to take a look at how i did this in .NET SDK. We need to be able to decide based on status and the request type, so I created a RetryEligibilityStrategy interface that can be re-used across different retry strategies:

https://github.com/momentohq/client-sdk-dotnet/blob/main/src/Momento.Sdk/Internal/Retry/DefaultRetryEligibilityStrategy.cs

https://github.com/momentohq/client-sdk-dotnet/blob/main/src/Momento.Sdk/Config/Retry/IRetryEligibilityStrategy.cs

https://github.com/momentohq/client-sdk-dotnet/blob/main/src/Momento.Sdk/Config/Retry/FixedCountRetryStrategy.cs#L29

grpc.WithTransportCredentials(credentials.NewTLS(config)),
grpc.WithUnaryInterceptor(interceptor.AddHeadersInterceptor(authToken)),
grpc.WithUnaryInterceptor(grpc_retry.UnaryClientInterceptor([]grpc_retry.CallOption{
grpc_retry.WithMax(request.Config.GetRetryStrategy().GetMaxRetries()),
Copy link
Collaborator

Choose a reason for hiding this comment

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

it looks like maybe you are trying to use an off-the-shelf one here? That's appealing but in most of the other languages I'm finding that the off-the-shelf ones can't actually handle our use case (e.g. no way to specify whether to retry based on request type, and we don't want to retry non-idempotent operations)

Copy link
Collaborator

Choose a reason for hiding this comment

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

also FWIW I haven't necessarily been adding retries for control plane in some of the other sdks for now, but i don't feel strongly about that

grpc.WithStreamInterceptor(grpc_retry.StreamClientInterceptor([]grpc_retry.CallOption{
grpc_retry.WithMax(request.Config.GetRetryStrategy().GetMaxRetries()),
grpc_retry.WithPerRetryTimeout(request.Config.GetRetryStrategy().GetPerRetryTimeout()),
grpc_retry.WithCodes(request.Config.GetRetryStrategy().GetRetryableRequestStatuses()...),
Copy link
Collaborator

Choose a reason for hiding this comment

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

what does retry mean for a stream interceptor?

grpc.WithUnaryInterceptor(grpc_retry.UnaryClientInterceptor([]grpc_retry.CallOption{
grpc_retry.WithMax(request.Config.GetRetryStrategy().GetMaxRetries()),
grpc_retry.WithPerRetryTimeout(request.Config.GetRetryStrategy().GetPerRetryTimeout()),
grpc_retry.WithCodes(request.Config.GetRetryStrategy().GetRetryableRequestStatuses()...),
Copy link
Collaborator

Choose a reason for hiding this comment

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

same thoughts here about off-the-shelf and support for configuring by request type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

client side timeouts for pubsusb think about proper settings Implement Client Side Retries and add to config
2 participants