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 oras cp #1142

Merged
merged 2 commits into from
Oct 13, 2023
Merged

Conversation

qweeah
Copy link
Contributor

@qweeah qweeah commented Oct 12, 2023

What this PR does / why we need it:
This PR reduces the auth request sent to destination registry of oras cp

Before

request: HEAD manifest digest - 401
request: POST token (scope: pull) - 200
request: HEAD manifest digest  - 404
...
request: HEAD blob digest - 404
request: POST blob - 401
request: POST token (scope: pull, push) - 200
request: POST blob - 202
request: PUT blob - 201

After

request: HEAD manifest digest - 401
request: POST token (scope: pull, push) - 200
request: HEAD manifest digest  - 404
...
request: HEAD blob digest - 404
request: POST blob - 202
request: PUT blob - 201

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1105

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

@codecov-commenter
Copy link

Codecov Report

Merging #1142 (ac81631) into main (0744892) will increase coverage by 0.01%.
The diff coverage is 100.00%.

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

@@            Coverage Diff             @@
##             main    #1142      +/-   ##
==========================================
+ Coverage   80.12%   80.14%   +0.01%     
==========================================
  Files          57       57              
  Lines        2994     2996       +2     
==========================================
+ Hits         2399     2401       +2     
  Misses        410      410              
  Partials      185      185              
Files Coverage Δ
cmd/oras/root/cp.go 81.70% <100.00%> (+0.34%) ⬆️
internal/registryutil/auth.go 100.00% <100.00%> (ø)

@Wwwsylvia
Copy link
Member

Wrong reference, please ignore.
image

Copy link
Member

@Wwwsylvia Wwwsylvia left a comment

Choose a reason for hiding this comment

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

Should the PR title start with just perf:?🤔

internal/registryutil/auth.go Show resolved Hide resolved
@qweeah qweeah changed the title feat(perf): reduce auth request count for oras cp perf: reduce auth request count for oras cp Oct 12, 2023
Copy link
Member

@Wwwsylvia Wwwsylvia left a comment

Choose a reason for hiding this comment

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

LGTM, but I am not a maintainer.

Copy link
Member

@TerryHowe TerryHowe left a comment

Choose a reason for hiding this comment

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

/lgtm

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

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@qweeah qweeah merged commit f1ef429 into oras-project:main Oct 13, 2023
6 checks passed
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.

Optimize the number of auth requests for oras cp
5 participants