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

perf: reduce auth request count for manifest delete #623

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

Wwwsylvia
Copy link
Member

@Wwwsylvia Wwwsylvia commented Oct 20, 2023

Backporting 0f1dc30 to the release branch.
This change does the same thing as the original commit (#618) did but using the old registryutil.WithScopeHint instead of auth.AppendRepositoryScope, which is introduced by #604 and is not available in v2.3.x.


Add pull and delete scope hints before attempting client-side indexing on manifest delete.

Before this change, the requests produced during deleting a manifest when Referrers API is not known to be available:

  • Request #0: GET manifest - 401
  • Request #1: POST token (scope: pull) - 200
  • Request #2: GET manifest - 200
  • [optional] Request #3: GET referrers index - 200
  • [optional] Request #4: PUT referrers index - 401
  • [optional] Request #5: POST token (scope: pull, push) - 200
  • [optional] Request #6: PUT referrers index - 201
  • Request #7: DELETE manifest - 401
  • Request #8: POST token (scope: delete)
  • Request #9: DELETE manifest - 202

After this change, the requests should become:

  • Request #0: GET manifest - 401
  • Request #1: POST token (scope: pull, delete) - 200
  • Request #2: GET manifest - 200
  • [optional] Request #3: GET referrers index - 200
  • [optional] Request #4: PUT referrers index - 401
  • [optional] Request #5: POST token (scope: pull, push) - 200
  • [optional] Request #6: PUT referrers index - 201
  • Request #7: DELETE manifest - 202

@codecov-commenter
Copy link

Codecov Report

Merging #623 (ea0878d) into release-2.3 (f175957) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@             Coverage Diff              @@
##           release-2.3     #623   +/-   ##
============================================
  Coverage        74.45%   74.46%           
============================================
  Files               51       51           
  Lines             4847     4848    +1     
============================================
+ Hits              3609     3610    +1     
  Misses             908      908           
  Partials           330      330           
Files Coverage Δ
registry/remote/repository.go 71.21% <100.00%> (+0.02%) ⬆️

Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

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

LGTM

@Wwwsylvia Wwwsylvia changed the title perf: reduce auth request count for manifest delete perf: backport: reduce auth request count for manifest delete Oct 20, 2023
@Wwwsylvia Wwwsylvia changed the title perf: backport: reduce auth request count for manifest delete perf: reduce auth request count for manifest delete Oct 20, 2023
@Wwwsylvia Wwwsylvia merged commit f296072 into oras-project:release-2.3 Oct 20, 2023
7 checks passed
@Wwwsylvia Wwwsylvia deleted the backport_perf branch October 20, 2023 08:51
@Wwwsylvia Wwwsylvia mentioned this pull request Oct 20, 2023
4 tasks
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.

3 participants