mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #298] [MERGED] feat(snapshot): accelerate cold resume with startup first-touch manifests #327
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#327
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/298
Author: @huajq
Created: 9/16/2026
Status: ✅ Merged
Merged: 9/18/2026
Merged by: @yingdi-shan
Base:
main← Head:trace-manifest📝 Commits (2)
79ce937feat(snapshot): record startup first-touch and upload manifests decoupled0bf3cb6feat(snapshot): prefetch startup manifests concurrently at resume📊 Changes
52 files changed (+5218 additions, -113 deletions)
View changed files
📝
config/default.toml(+17 -0)📝
crates/e2e-tests/tests/snapshot_oss_e2e_test.rs(+5 -0)📝
src/api/impls/image_build/tests.rs(+1 -1)📝
src/bin/server.rs(+6 -0)📝
src/cfg.rs(+40 -0)📝
src/sandbox/backend.rs(+9 -2)📝
src/sandbox/firecracker/config.rs(+15 -0)📝
src/sandbox/firecracker/mod.rs(+3 -1)📝
src/sandbox/firecracker/sandbox.rs(+178 -33)➕
src/sandbox/firecracker/startup_pack.rs(+327 -0)📝
src/sandbox/manifest.rs(+21 -0)📝
src/sandbox/mock.rs(+8 -2)📝
src/sandbox/mod.rs(+4 -3)📝
src/sandbox/ublk/device.rs(+105 -1)📝
src/sandbox/ublk/mod.rs(+1 -1)📝
src/snapshot/manager.rs(+25 -6)📝
src/snapshot/mock.rs(+1 -0)📝
src/snapshot/mod.rs(+6 -0)📝
src/snapshot/repository/backends/oss/client.rs(+14 -0)📝
src/snapshot/repository/backends/oss/repository.rs(+268 -5)...and 32 more files
📄 Description
What
Two-commit change that cuts snapshot cold-resume time by prefetching the guest's early memory working set:
memory-startup.pack, and attaches a sha256-bound descriptor to the committed record. Publish never waits on any of this (measured ~16s → ~6s).Why
Cold resume of large-memory snapshots is dominated by on-demand remote reads: the guest stalls through hundreds of MiB of 256KiB faults before envd can answer its health probe. Recording once where the hot pages are and pulling them with few large ordered requests removes that serialization without changing any image formats or the read path.
Related issue
N/A — design iterated and A/B-validated offline (trace/pack variants evaluated and rejected in earlier rounds).
Scope and non-goals
Included: recording infra (ublk recorder + daemon RPC + recording VM orchestration), manifest codec, decoupled publish continuation, resolver/daemon prefetch path, graceful-shutdown drain semantics.
Excluded: first-program/workload-phase coverage (recording window covers boot+envd only), rootfs/attached-drive manifests, POSIX backend manifests, P2P transport of manifests, order-preserving per-block pull (A/B-tested and rejected: 2.4× more requests, slower envd-ready).
Design and behavior changes
AENVMF01header + optional exact-order page prefix + rank-sorted(offset,len)ranges; single version; unknown versions are skipped (plain on-demand resume). 51,338 pages → 784 ranges = 12.6KB.Compatibility and operations
PrefetchStartupPack(best-effort, always answersOk).[snapshot.memory_startup_pack]section (enabled,consume_enabled, record window/budget, consume timeout) — all default off, no behavior change unless enabled.memory-startup.packand optionalmemory_startuprecord field; records without it resume exactly as before.Validation
make fmt(viacargo fmt --all -- --check)make clippy— rancargo clippy -p overlaybd -p uvm-ublk-daemon -p agentenv --all-targets(clean) instead of the full targetmake test-unit— ran focused suites instead (see below)make -C services test— N/A (services/untouched)Commands and results:
Cluster A/B (AMD EPYC node, production snapshot chain 01a04285…, OSS backend, cold cache per run; median of 3):
(envd-ready ~6× faster; create ~4.8× faster; on-demand traffic at envd_ready ~93% lower. Manifest cost: 2.4s recording window + 12.6KB object, fully off the publish path.)
Risks and reviewer notes
storage/overlaybd/src/startup_manifest.rs(format),storage/overlaybd/src/backend/cache/startup_pack_task.rs(consume path), then the capture commit.Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.