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 separate blob for prefetched files #1629

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

Conversation

daiyongxuan
Copy link

Relevant Issue #1589

The objective is to create an independent image layer to prioritize the fetching of necessary blobs during startup, enhancing performance.

Details

This introduces the "optimize" subcommand, which generates a new blob containing prefetch files and creates a new RAFS format bootstrap. This ensures compatibility with the nydus-image check and optimizes the startup process.

@daiyongxuan daiyongxuan requested a review from a team as a code owner September 25, 2024 03:09
@daiyongxuan daiyongxuan requested review from jiangliu, gaius-qi and Desiki-high and removed request for a team September 25, 2024 03:09
let child = tree.get_node(&node.lock().unwrap().path()).unwrap();
let mut child = child.node.lock().unwrap();
child.layer_idx = prefetch_blob_index as u16;
for chunk in &mut child.chunks {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi , nice job!

how about just construct the new blob based on the compressed chunks from the original blob here, without needing to revert_files or modify the Blob::dump

Copy link

codecov bot commented Oct 22, 2024

Codecov Report

Attention: Patch coverage is 0.75758% with 393 lines in your changes missing coverage. Please review.

Project coverage is 60.04%. Comparing base (57c112a) to head (bf8a535).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
builder/src/chunkdict_generator.rs 0.00% 230 Missing ⚠️
src/bin/nydus-image/main.rs 0.00% 92 Missing ⚠️
storage/src/device.rs 0.00% 21 Missing ⚠️
builder/src/core/tree.rs 0.00% 16 Missing ⚠️
src/bin/nydus-image/prefetch.rs 0.00% 16 Missing ⚠️
builder/src/core/overlay.rs 0.00% 6 Missing ⚠️
src/bin/nydus-image/deduplicate.rs 0.00% 5 Missing ⚠️
builder/src/core/context.rs 0.00% 4 Missing ⚠️
src/bin/nydus-image/inspect.rs 0.00% 1 Missing ⚠️
storage/src/meta/mod.rs 0.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1629      +/-   ##
==========================================
- Coverage   60.51%   60.04%   -0.48%     
==========================================
  Files         146      147       +1     
  Lines       49178    49567     +389     
  Branches    46659    47048     +389     
==========================================
+ Hits        29761    29762       +1     
- Misses      17636    18023     +387     
- Partials     1781     1782       +1     
Files with missing lines Coverage Δ
builder/src/compact.rs 79.58% <ø> (ø)
builder/src/core/blob.rs 42.63% <100.00%> (ø)
builder/src/core/v6.rs 75.47% <ø> (ø)
builder/src/lib.rs 63.29% <100.00%> (+0.13%) ⬆️
rafs/src/metadata/direct_v6.rs 44.05% <100.00%> (+0.04%) ⬆️
rafs/src/metadata/inode.rs 90.51% <ø> (ø)
rafs/src/metadata/layout/v6.rs 85.03% <ø> (ø)
src/bin/nydus-image/inspect.rs 0.00% <0.00%> (ø)
storage/src/meta/mod.rs 72.17% <0.00%> (-0.05%) ⬇️
storage/src/meta/toc.rs 70.96% <0.00%> (-0.10%) ⬇️
... and 8 more

@imeoer imeoer changed the title Support Chunk Prefetch By Generating a New Blob And Bootstrap support generating separate blob for prefetched files Oct 23, 2024
storage/src/backend/localfs.rs Outdated Show resolved Hide resolved
src/bin/nydus-image/main.rs Show resolved Hide resolved
blobs_dir_path.to_path_buf(),
prefetch_nodes,
)
.unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Error should be handled instead of calling unwrap.

src/bin/nydus-image/main.rs Show resolved Hide resolved
output/chunkdict_bootstrap Outdated Show resolved Hide resolved
@daiyongxuan daiyongxuan requested a review from a team as a code owner October 25, 2024 03:58
@daiyongxuan daiyongxuan requested review from liubin and removed request for a team October 25, 2024 03:58
Signed-off-by: daiyongxuan <[email protected]>
@@ -81,6 +81,7 @@ func (n *NativeLayerTestSuite) TestMakeLayers() test.Generator {
ctx.Runtime.RafsMode = scenario.GetString(paramRafsMode)
ctx.Runtime.EnablePrefetch = scenario.GetBool(paramEnablePrefetch)
ctx.Runtime.AmplifyIO = scenario.GetUInt64(paramAmplifyIO)
ctx.Runtime.ChunkDedupDb = scenario.GetString(paramChunkDedupDb)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems like an unnecessary merge commit.

builder/src/chunkdict_generator.rs Outdated Show resolved Hide resolved
builder/src/chunkdict_generator.rs Outdated Show resolved Hide resolved
}
}

impl Read for BlobNodeReader {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems that File already implements Read, why do we still need to wrap it in a BlobNodeReader?

builder/src/chunkdict_generator.rs Outdated Show resolved Hide resolved
builder/src/chunkdict_generator.rs Outdated Show resolved Hide resolved
let mut blob_ctx = BlobContext::from(ctx, &blob_info, ChunkSource::Build)?;
blob_ctx.chunk_count = 0;
blob_ctx.blob_meta_info_enabled = true;
let blob_writer = ArtifactWriter::new(crate::ArtifactStorage::SingleFile(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should use ArtifactStorage::FileDir here.

src/bin/nydus-image/main.rs Outdated Show resolved Hide resolved
tree: &mut Tree,
ctx: &mut BuildContext,
bootstrap_mgr: &mut BootstrapManager,
blobtable: &mut RafsV6BlobTable,
Copy link
Collaborator

Choose a reason for hiding this comment

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

blob_table, and need also to be compatible with RAFS v5.

builder/src/chunkdict_generator.rs Outdated Show resolved Hide resolved
builder/src/chunkdict_generator.rs Outdated Show resolved Hide resolved
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