mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #267] [CLOSED] feat(snapshot): prefetch envd memory pages at resume for faster envd-ready #305
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#305
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/AgentENV/pull/267
Author: @huajq
Created: 9/9/2026
Status: ❌ Closed
Base:
main← Head:feat/envd-prefetch-wip2📝 Commits (2)
06fda16feat(snapshot): prefetch envd memory pages at resume for faster envd-ready8ac10b2fix(snapshot): address AI review findings on envd prefetch📊 Changes
26 files changed (+1147 additions, -9 deletions)
View changed files
📝
.gitignore(+1 -0)📝
CLAUDE.md(+7 -0)📝
docs/src/concepts/snapshots.md(+19 -0)📝
src/sandbox/firecracker/config.rs(+24 -0)📝
src/sandbox/firecracker/manifest.rs(+7 -0)📝
src/sandbox/firecracker/mod.rs(+1 -0)➕
src/sandbox/firecracker/pagedump.rs(+93 -0)📝
src/sandbox/firecracker/sandbox.rs(+190 -0)📝
src/sandbox/ublk/device.rs(+20 -0)📝
src/snapshot/mod.rs(+7 -0)➕
src/snapshot/prefetch.rs(+150 -0)📝
src/snapshot/repository/backends/oss/client.rs(+2 -0)📝
src/snapshot/repository/backends/oss/repository.rs(+56 -1)📝
src/snapshot/repository/backends/oss/resolver.rs(+23 -1)📝
src/snapshot/repository/backends/posixfs/artifacts.rs(+77 -2)📝
src/snapshot/repository/backends/posixfs/runtime.rs(+43 -3)📝
storage/ublk-daemon/Cargo.toml(+1 -0)📝
storage/ublk-daemon/src/client.rs(+27 -0)📝
storage/ublk-daemon/src/protocol.rs(+11 -0)📝
storage/ublk-daemon/src/server.rs(+192 -0)...and 6 more files
📄 Description
What
Record the guest init daemon's (envd) resident guest-physical address ranges at snapshot capture and bulk-prefetch those pages into the node's remote-block cache before the VM resumes, so envd's early startup no longer waits on one-at-a-time remote reads.
Why
Resuming a snapshot stalls envd-ready on a serial demand-page-fault chain (~256 KiB × ~21 ms OSS RTT per read, bounded by vCPU count). Measured on a cold OSS-backed snapshot: envd-ready improves from 5.47 s to 2.13 s (-61%) with prefetch enabled.
Related issue
Closes #
Scope and non-goals
aenv-pagedumptools-drive binary;memory-prefetch.jsonartifact publish/resolve on OSS and posix_fs; aPrefetchRPC on the ublk daemon; resume-time trigger; tests and docs.KVM_PRE_FAULT_MEMORY(requires kernel ≥ 6.11, not available on the fleet); page-fault trace recording/replay; changes to snapshot layering or capture content; any modification of the guest kernel.Design and behavior changes
spawn_blocking+ dedicated runtime with a 10 s timeout so a wedged envd can never stall capture.aenv-pagedump) simply produce no manifest — behavior unchanged from today.Compatibility and operations
Prefetchvariant on the internal ublk-daemon Unix-socket protocol; old client → new daemon fails safe (warn only); new client → old daemon unaffected. No external API change.artifacts/{id}/memory-prefetch.json;FirecrackerSnapshotManifestgains a#[serde(skip)]runtime-only field; both are backward compatible.aenv-pagedump(newtools-image/pagedumpcrate + Dockerfile stage); older tools drives degrade gracefully.Validation
make fmtmake clippymake test-unitmake -C services test(required whenservices/changes) — N/ACommands and results:
Skipped checks and reasons:
make -C services test— noservices/changes. Generated-code regeneration — N/A (hand-written protocol variant, no codegen involved).Risks and reviewer notes
src/sandbox/firecracker/pagedump.rs,src/snapshot/prefetch.rs,storage/ublk-daemon/src/server.rs(handle_prefetch),tools-image/pagedump/src/main.rs.Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.