spinframework/containerd-shim-spin
Redundant file copies for every pod start
Open
#40 opened on Mar 13, 2024
help wanted
Repository metrics
- Stars
- (138 stars)
- PR merge metrics
- (PR metrics pending)
Description
The startup time for a Spin application distributed as an OCI artifact is affected by several copies of the Wasm components and static assets on disk.
- first, we write the OCI layers returned by runwasi on disk, in a directory structure that follows Spin's OCI loader: https://github.com/spinkube/containerd-shim-spin/blob/a42715e542a167d7b02a6725cf6d6d0fa96c1912/containerd-shim-spin/src/engine.rs#L104-L141
- we then call
load_from_cache(https://github.com/spinkube/containerd-shim-spin/blob/a42715e542a167d7b02a6725cf6d6d0fa96c1912/containerd-shim-spin/src/engine.rs#L165), which in turn calls Spin's loader, which copies the files into a temporary directory: https://github.com/fermyon/spin/blob/7f55409a7b75c8dc52bc77fdaa5ba1e71a524b8d/crates/oci/src/loader.rs#L103
Since this time is spent on every pod start, my assumption is that it affects performance, in particular for applications with a higher number of components and assets.
I'd like to see if we can improve this, potentially by implementing a Spin application loader that directly uses the runwasi list of WasmLayers and skips all the copies.