feat: use node-local overlayfs rootfs cache to eliminate per-restore untar (#228)#283
Open
chenggui53 (chenggui53) wants to merge 1 commit into
Open
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Implements issue agent-substrate#228: cache extracted rootfs per image digest on each node, and materialize per-actor bundles as overlayfs mounts instead of re-untarring on every restore. Changes: - New rootfscache package (cmd/atelet/internal/rootfscache) - New overlay.go with mount/unmount helpers - Modified prepareOCIDirectory for overlayfs integration - Updated resetActorDirs to unmount before cleanup - Added rootfs cache paths to ateompath - Unit tests for cache hit/miss, concurrent access, eviction
2b2efc3 to
970a309
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #228: cache one extracted, read-only rootfs per immutable image digest on each node, and materialize each actor's bundle as a thin overlayfs mount instead of re-untarring the whole image on every restore.
Problem
Every
Restorecall in atelet fully reconstructs the rootfs by pulling and untarring the OCI image — even when the same image digest has already been extracted on the same node many times before. Observed cost:prepareOCIDirectory(untar rootfs): ~15–20srunsc restore(checkpoint restore): ~268msRootfs extraction dominates resume latency by ~99%.
Solution
Change the scaling behavior from "every restore pays extraction cost" to "first restore of a digest on a node pays extraction; later restores pay only an overlay mount."
On first use of an image digest on a node:
/var/lib/ateom-gvisor/rootfs-cache/<sha256>/lower/On every restore using the same digest:
RemoveAll+untar, set up an overlayfs mount for the actor bundle's rootfs:lowerdir= the cached, read-only extracted rootfs (shared, never mutated)upperdir+workdir= per-actor, actor-private writable layersChanges
internal/ateompath/ateompath.goRootfsCacheDirandRootfsCacheLowerDir()cmd/atelet/internal/rootfscache/rootfscache.goEnsureRootfs,Untar,ValidateTarName, LRU eviction, concurrent dedupcmd/atelet/internal/rootfscache/rootfscache_test.gocmd/atelet/overlay.goisOverlayfsAvailable()cmd/atelet/oci.goprepareOCIDirectoryintegrates overlayfs path with untar fallback;extractDigestFromRef;unmountActorRootfscmd/atelet/main.goAteomHerder,resetActorDirsadds unmount before cleanupKey Design Decisions
inflightEntrydedup — N goroutines requesting the same digest only trigger 1 untar.readysentinel file;loadIndexauto-cleans partial entries from previous crashes.last_accesstimestamp, async trigger, 20GB default capresetActorDirsdoesMNT_DETACHunmount on overlayfs rootfs beforeRemoveAllExpected Impact
Testing
go test ./cmd/atelet/...)Open Questions (for follow-up)