containerd / stargz-snapshotter

Fast container image distribution plugin with lazy pulling
https://github.com/containerd/containerd/issues/3731
Apache License 2.0
1.19k stars 116 forks source link

Add FUSE Passthrough Support in Stargz-Snapshotter #1867

Open wswsmao opened 6 days ago

wswsmao commented 6 days ago

Hi,

FUSE Passthrough has been introduced in the Linux kernel version 6.9. This feature has shown significant performance improvements, as detailed in the following articles:

Phoronix Article on FUSE Passthrough Linux Kernel Commit

Additionally, the go-fuse package, which Stargz-Snapshotter depends on, has also added support for this passthrough feature:

go-fuse Commit 1 go-fuse Commit 2 go-fuse Commit 3

When a user-defined file implements the FilePassthroughFder interface, go-fuse will attempt to register the file fd from the file with the kernel.

I believe it would be beneficial for Stargz-Snapshotter to consider supporting this feature as well. Here’s a proposed implementation plan for FUSE passthrough:

  1. During the Open phase, attempt to pre-read the entire file instead of reading it in chunks.
  2. Utilize the existing cache's Get method to retrieve the fd of the cached file that has been written to local storage.
  3. Implement the FilePassthroughFder interface in node.file, allowing the fd from step 2 to be registered with the kernel via go-fuse.

By following this approach, subsequent Read operations would not need to return to user space, and go-fuse would release the registered information when necessary.

Thank you for considering this enhancement!

Best regards, abush wang

wswsmao commented 6 days ago

The lattest commit is the implementation for FUSE Passthrough support in stargz-snapshotter https://github.com/wswsmao/stargz-snapshotter/tree/passthrough

ktock commented 6 days ago

SGTM. Could you open a PR?

wswsmao commented 6 days ago

SGTM. Could you open a PR?

OK, this is pr https://github.com/containerd/stargz-snapshotter/pull/1868