Skip to content

perf: reduce auth request count for oras cp#1142

Merged
qweeah merged 2 commits into
oras-project:mainfrom
qweeah:auth-cp
Oct 13, 2023
Merged

perf: reduce auth request count for oras cp#1142
qweeah merged 2 commits into
oras-project:mainfrom
qweeah:auth-cp

Conversation

@qweeah

@qweeah qweeah commented Oct 12, 2023

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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
Copy Markdown
Member

Wrong reference, please ignore.
image

@Wwwsylvia Wwwsylvia left a comment

Copy link
Copy Markdown
Member

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:?🤔

Comment thread internal/registryutil/auth.go
@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

@Wwwsylvia Wwwsylvia left a comment

Copy link
Copy Markdown
Member

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.

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@shizhMSFT shizhMSFT left a comment

Copy link
Copy Markdown
Contributor

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
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