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

Add Retryable HTTP Client #502

Closed
akashsinghal opened this issue Dec 15, 2022 · 2 comments · Fixed by #505
Closed

Add Retryable HTTP Client #502

akashsinghal opened this issue Dec 15, 2022 · 2 comments · Fixed by #505
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@akashsinghal
Copy link
Collaborator

Describe the solution you'd like
Currently Ratify’s built in ORAS store, does not utilize request back off retries when sending requests to registry. The server can receive multiple concurrent requests to validate images from the same registry or multiple images from the same registry in the same request. This can cause the # of simultaneous requests to the registry to the exceed the registry threshold leading to 429s returned. Ratify should use a retry-able http client with ORAS-go to help alleviate the issue.

Environment:

  • Ratify version: (use the image tag): Ratify v1.0.0-beta.2
  • Kubernetes version: (use kubectl version): 1.25.4
@akashsinghal akashsinghal added the enhancement New feature or request label Dec 15, 2022
@akashsinghal akashsinghal self-assigned this Dec 15, 2022
@sajayantony
Copy link
Contributor

/cc @shizhMSFT

@shizhMSFT
Copy link
Collaborator

oras-go will implement a default retry mechanism in its version 2.0.0 release as being discussed in oras-project/oras-go#232.

Besides, oras-go also supports 3rd party retry-able HTTP client such as github.com/hashicorp/go-retryablehttp. Here's the example code of how to integrate go-retryablehttp with oras-go/v2/registry/remote/auth.Client:

retryClient := retryablehttp.NewClient()
retryClient.RetryMax = 10

authClient := &auth.Client{
    Client: retryClient.StandardClient()
}

// use `authClient` for registry access

Since ratify is dealing with lots of 429s, it is suggested to configure retry with jitters.

To be more scalable, ratify may consider caching or other mechanisms to reduce the request rate to a single registry.

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

Successfully merging a pull request may close this issue.

3 participants