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

storage: simplify mirror implementation #1375

Merged
merged 3 commits into from
Jul 25, 2023

Conversation

imeoer
Copy link
Collaborator

@imeoer imeoer commented Jul 17, 2023

Nydusd uses a registry backend which generates a surge of blob requests without
auth tokens on initial startup. This caused mirror backends (e.g. dragonfly)
to process very slowly, the commit fixes this problem.

It implements waiting for the first blob request to complete before making other
blob requests, this ensures the first request caches a valid registry auth token,
and subsequent concurrent blob requests can reuse the cached token.

This change is worthwhile to reduce concurrent token requests, it also makes the
behavior consistent with containerd, which first requests the image manifest and
caches the token before concurrently requesting blobs.

Relevant Issue (if applicable)

If there are Issues related to this PullRequest, please list it.

Details

Please describe the details of PullRequest.

Types of changes

What types of changes does your PullRequest introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

Go over all the following points, and put an x in all the boxes that apply.

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@imeoer imeoer requested a review from a team as a code owner July 17, 2023 08:45
@imeoer imeoer requested review from liubin, luodw and adamqqqplay and removed request for a team July 17, 2023 08:45
@imeoer imeoer changed the title [WIP] storage: implement simpler first token request [WIP] storage: simplify mirror implementation Jul 17, 2023
@codecov
Copy link

codecov bot commented Jul 17, 2023

Codecov Report

Merging #1375 (dc83210) into master (be52ebd) will increase coverage by 0.09%.
The diff coverage is 49.69%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1375      +/-   ##
==========================================
+ Coverage   46.17%   46.26%   +0.09%     
==========================================
  Files         122      122              
  Lines       37913    37970      +57     
  Branches    37913    37970      +57     
==========================================
+ Hits        17506    17567      +61     
+ Misses      19489    19481       -8     
- Partials      918      922       +4     
Impacted Files Coverage Δ
api/src/config.rs 70.52% <ø> (-0.04%) ⬇️
storage/src/backend/object_storage.rs 32.07% <0.00%> (+4.20%) ⬆️
storage/src/backend/connection.rs 43.00% <18.75%> (+0.45%) ⬆️
storage/src/backend/registry.rs 34.20% <53.42%> (+7.27%) ⬆️
storage/src/backend/http_proxy.rs 75.14% <100.00%> (-0.64%) ⬇️

... and 3 files with indirect coverage changes

@imeoer imeoer force-pushed the storage-mirror-refactor branch 3 times, most recently from c5c719b to 4513dce Compare July 18, 2023 10:52
@imeoer imeoer changed the title [WIP] storage: simplify mirror implementation storage: simplify mirror implementation Jul 18, 2023
@anolis-bot
Copy link
Collaborator

@imeoer , the title has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/85389

@imeoer imeoer force-pushed the storage-mirror-refactor branch from 4513dce to c5d4144 Compare July 18, 2023 10:58
@anolis-bot
Copy link
Collaborator

@imeoer , the code has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/85390

@imeoer imeoer force-pushed the storage-mirror-refactor branch from c5d4144 to ff5f83f Compare July 18, 2023 11:02
@anolis-bot
Copy link
Collaborator

@imeoer , the code has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/85391

@anolis-bot
Copy link
Collaborator

@imeoer , The CI test is completed, please check result:

Test CaseTest Result
build rust golang image✅ SUCCESS
compile nydusd✅ SUCCESS
compile ctr remote✅ SUCCESS
compile nydus snapshotter✅ SUCCESS
run container with rafs✅ SUCCESS
run container with zran✅ SUCCESS
run container with rafs and compile linux✅ SUCCESS

Congratulations, your test job passed!

@anolis-bot
Copy link
Collaborator

@imeoer , The CI test is completed, please check result:

Test CaseTest Result
build rust golang image✅ SUCCESS
compile nydusd✅ SUCCESS
compile ctr remote✅ SUCCESS
compile nydus snapshotter✅ SUCCESS
run container with rafs✅ SUCCESS
run container with zran✅ SUCCESS
run container with rafs and compile linux✅ SUCCESS

Congratulations, your test job passed!

@anolis-bot
Copy link
Collaborator

@imeoer , the title has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/85392

@anolis-bot
Copy link
Collaborator

@imeoer , the title has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/85393

@anolis-bot
Copy link
Collaborator

@imeoer , The CI test is completed, please check result:

Test CaseTest Result
build rust golang image✅ SUCCESS
compile nydusd✅ SUCCESS
compile ctr remote✅ SUCCESS
compile nydus snapshotter✅ SUCCESS
run container with rafs✅ SUCCESS
run container with zran✅ SUCCESS
run container with rafs and compile linux✅ SUCCESS

Congratulations, your test job passed!

@anolis-bot
Copy link
Collaborator

@imeoer , The CI test is completed, please check result:

Test CaseTest Result
build rust golang image✅ SUCCESS
compile nydusd✅ SUCCESS
compile ctr remote✅ SUCCESS
compile nydus snapshotter✅ SUCCESS
run container with rafs✅ SUCCESS
run container with zran✅ SUCCESS
run container with rafs and compile linux✅ SUCCESS

Congratulations, your test job passed!

@anolis-bot
Copy link
Collaborator

@imeoer , The CI test is completed, please check result:

Test CaseTest Result
build rust golang image✅ SUCCESS
compile nydusd✅ SUCCESS
compile ctr remote✅ SUCCESS
compile nydus snapshotter✅ SUCCESS
run container with rafs✅ SUCCESS
run container with zran✅ SUCCESS
run container with rafs and compile linux✅ SUCCESS

Congratulations, your test job passed!

@anolis-bot
Copy link
Collaborator

@imeoer , The CI test is completed, please check result:

Test CaseTest Result
build rust golang image✅ SUCCESS
compile nydusd✅ SUCCESS
compile ctr remote✅ SUCCESS
compile nydus snapshotter✅ SUCCESS
run container with rafs✅ SUCCESS
run container with zran✅ SUCCESS
run container with rafs and compile linux✅ SUCCESS

Congratulations, your test job passed!

@anolis-bot
Copy link
Collaborator

@imeoer , the code has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/85533

@anolis-bot
Copy link
Collaborator

@imeoer , The CI test is completed, please check result:

Test CaseTest Result
build rust golang image✅ SUCCESS
compile nydusd❌ FAIL

Sorry, your test job failed. Please get the details in the link.

imeoer added 3 commits July 19, 2023 10:41
Nydusd uses a registry backend which generates a surge of blob requests without
auth tokens on initial startup. This caused mirror backends (e.g. dragonfly)
to process very slowly, the commit fixes this problem.

It implements waiting for the first blob request to complete before making other
blob requests, this ensures the first request caches a valid registry auth token,
and subsequent concurrent blob requests can reuse the cached token.

This change is worthwhile to reduce concurrent token requests, it also makes the
behavior consistent with containerd, which first requests the image manifest and
caches the token before concurrently requesting blobs.

Signed-off-by: Yan Song <[email protected]>
The auth_through option adds user burden to configure the mirror
and understand its meaning, and since we have optimized handling
of concurrent token requests, this option can now be removed.

Signed-off-by: Yan Song <[email protected]>
- Make registry mirror log pretty;
- Adjust token refresh interval automatically;

Signed-off-by: Yan Song <[email protected]>
@anolis-bot
Copy link
Collaborator

@imeoer , the code has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/85559

@anolis-bot
Copy link
Collaborator

@imeoer , The CI test is completed, please check result:

Test CaseTest Result
build rust golang image✅ SUCCESS
compile nydusd✅ SUCCESS
compile ctr remote✅ SUCCESS
compile nydus snapshotter✅ SUCCESS
run container with rafs✅ SUCCESS
run container with zran✅ SUCCESS
run container with rafs and compile linux✅ SUCCESS

Congratulations, your test job passed!

@imeoer imeoer requested a review from sctb512 July 20, 2023 03:17
Copy link
Contributor

@sctb512 sctb512 left a comment

Choose a reason for hiding this comment

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

LGTM

@imeoer
Copy link
Collaborator Author

imeoer commented Jul 24, 2023

Merge it first, will update nydus-snapshotter later.

@imeoer
Copy link
Collaborator Author

imeoer commented Jul 24, 2023

@jiangliu PTAL.

@jiangliu jiangliu merged commit 58842cb into dragonflyoss:master Jul 25, 2023
imeoer added a commit to imeoer/nydus-snapshotter that referenced this pull request Aug 1, 2023
We have removed the `auth_through` option in dragonflyoss/nydus#1375

Let's remove it in snapshotter, since its default value is
false, there is no compatibility impact.

Signed-off-by: Yan Song <[email protected]>
sctb512 pushed a commit to sctb512/nydus-snapshotter that referenced this pull request Sep 11, 2023
We have removed the `auth_through` option in dragonflyoss/nydus#1375

Let's remove it in snapshotter, since its default value is
false, there is no compatibility impact.

Signed-off-by: Yan Song <[email protected]>
hangvane pushed a commit to hangvane/nydus-snapshotter that referenced this pull request Oct 16, 2023
We have removed the `auth_through` option in dragonflyoss/nydus#1375

Let's remove it in snapshotter, since its default value is
false, there is no compatibility impact.

Signed-off-by: Yan Song <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants