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

support generating new image with separate blob for prefetched files #1649

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Maxing1997
Copy link

Relevant Issue #1589

The objective is to generate a new image, which references a new blob included prefetch file chunks. This will accelerate an startup performance due to high-priority pulling of prefetch blob.

Details

Implement optimize subcommand of nydusify to generate a new image, which references a new blob included prefetch file chunks.

Types of changes

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

  • New feature (non-breaking change which adds functionality)

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.

Major changes:
1. Added compatibility for rafs v5/v6 formats.
2. Set IS_PREFETCHBLOB flag in BlobInfo for prefetchblob.
3. Introduced two new options for storing prefetchblobID path and the optimized bootstrap path.

Signed-off-by: Xing Ma <[email protected]>
@Maxing1997 Maxing1997 requested a review from a team as a code owner November 29, 2024 09:19
@Maxing1997 Maxing1997 requested review from imeoer, jiangliu and gaius-qi and removed request for a team November 29, 2024 09:20
@Maxing1997 Maxing1997 changed the title Maxing mr/nydusify optimize support generating new image with separate blob for prefetched files Nov 29, 2024
We can statically analyze the image entrypoint dependency, or use runtime dynamic
analysis technologies such as ebpf, fanotify, metric, etc. to obtain the container
file access pattern, and then build this part of data into an independent image layer:

* preferentially fetch blob during the image startup phase to reduce network and disk IO.
* avoid frequent image builds, allows for better local cache utilization.

Implement optimize subcommand of nydusify to generate a new image, which references a new
blob included prefetch file chunks.
```
nydusify optimize --policy separated-prefetch-blob \
	--source $existed-nydus-image \
	--target $new-nydus-image \
	--prefetch-files /path/to/prefetch-files
```

More detailed process is as follows:
1. nydusify first downloads the source image and bootstrap, utilize nydus-image to output a
new bootstrap along with an independent prefetchblob;
2. nydusify generate&push new meta layer including new bootstrap and the prefetch-files ,
also generates&push new manifest/config/prefetchblob, completing the incremental image build.

Signed-off-by: Xing Ma <[email protected]>
Copy link

codecov bot commented Nov 29, 2024

Codecov Report

Attention: Patch coverage is 0% with 118 lines in your changes missing coverage. Please review.

Project coverage is 59.98%. Comparing base (375f55f) to head (8437d8d).

Files with missing lines Patch % Lines
builder/src/optimize_prefetch.rs 0.00% 51 Missing ⚠️
src/bin/nydus-image/main.rs 0.00% 35 Missing ⚠️
contrib/nydusify/cmd/nydusify.go 0.00% 27 Missing ⚠️
storage/src/device.rs 0.00% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1649      +/-   ##
==========================================
- Coverage   60.10%   59.98%   -0.13%     
==========================================
  Files         147      147              
  Lines       49513    49603      +90     
  Branches    46994    47057      +63     
==========================================
- Hits        29762    29756       -6     
- Misses      17970    18065      +95     
- Partials     1781     1782       +1     
Files with missing lines Coverage Δ
storage/src/device.rs 66.63% <0.00%> (-0.36%) ⬇️
contrib/nydusify/cmd/nydusify.go 13.52% <0.00%> (-0.54%) ⬇️
src/bin/nydus-image/main.rs 0.58% <0.00%> (-0.01%) ⬇️
builder/src/optimize_prefetch.rs 0.00% <0.00%> (ø)

... and 3 files with indirect coverage changes

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.

1 participant