mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #177] [MERGED] fix(snapshot): parallelize OSS layer uploads and skip publish-time re-hash #229
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#229
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/177
Author: @huajq
Created: 8/17/2026
Status: ✅ Merged
Merged: 8/18/2026
Merged by: @yingdi-shan
Base:
main← Head:feat/oss-upload-throughput📝 Commits (1)
2007bdbfix(snapshot): parallelize OSS layer uploads and skip publish-time re-hash📊 Changes
7 files changed (+246 additions, -25 deletions)
View changed files
📝
src/sandbox/firecracker/overlaybd_snapshot.rs(+17 -10)📝
src/sandbox/firecracker/sandbox.rs(+3 -2)📝
src/sandbox/ublk/mod.rs(+1 -1)📝
src/sandbox/ublk/overlaybd.rs(+37 -10)📝
src/snapshot/repository/backends/oss/client.rs(+15 -2)➕
storage/overlaybd/src/lsmt/file/digest_tracking.rs(+171 -0)📝
storage/overlaybd/src/lsmt/file/mod.rs(+2 -0)📄 Description
What
Speed up OSS snapshot layer uploads and remove a redundant full-file hash from the publish path:
Why
Production snapshot publishes of large sandboxes could not finish within client deadlines: single-stream multipart uploads to the OSS internal endpoint top out at ~100 MB/s, so a ~215 GiB rootfs layer needs ~37 min of pure upload, plus a full 215 GiB re-read for hashing before every upload. Retrying on every 30 min client timeout made the failure deterministic. Measured against an isolated OSS validation bucket with an 8 GiB object: serial default 64.6 MiB/s, serial 64 MiB chunk 80.8 MiB/s, 64 MiB chunk x8 concurrent 697-800 MiB/s (~10x).
Related issue
N/A (no tracking issue; root-caused from production incident analysis)
Scope and non-goals
Included:
oss/client.rs: 64 MiBCHUNK_SIZEviawriter_with().chunk(),UPLOAD_CONCURRENCY=8.create_commit_args_with_digest()+compact_layers/ memory-snapshot layer builder: record the descriptor in the stagedimage.jsonlowers (rootfs compaction and memory layer), so publish usesimport_managed_layer_with_descriptor(HEAD existence check).lsmt/file/digest_tracking.rs(new):DigestTrackingFile(file-order streaming sha256 overwrite_at) andOrderedWriter(forces ordered compaction writes), exported viaoverlaybd::index_file.Excluded (follow-ups, intentionally not here):
Design and behavior changes
DigestTrackingFilehashes only strictly in-order writes; any out-of-order write poisons the tracker and yields no descriptor, in which case publish falls back to the previous explicit file hash.OrderedWriterforces compact_to's ordered branch (reads stay 32-way concurrent, writes serialize) so raw outputs also hash correctly. The zfile path required file-level (not CompactWriter-level) hashing because CompactWriter sees pre-compression bytes.image.jsonlowers for locally produced layers now carry non-emptydigest/sizewhen they could be computed inline; previously always empty for these entries.Compatibility and operations
image.jsonlower entries gaindigest/sizevalues; consumers already tolerate them (descriptor-aware import path existed and is used for restacked layers today). OSS object keys remain content-addressed by the same sha256 convention.Validation
make fmt(cargo fmt --all -- --check)make clippy(cargo clippy -p overlaybd -p agentenv --all-targets -- -D warnings)make test-unitequivalent: cargo test -p overlaybd --lib; cargo test -p agentenv --lib (see notes)Commands and results:
Skipped checks and reasons:
make -C services test: noservices/changes.Risks and reviewer notes
lsmt/file/digest_tracking.rsabsorb-order logic and the zfile write-order assumption (validated by the lz4/zstd compact_layers test).local_layer_configin overlaybd_snapshot.rs is now test-only (#[cfg(test)]) since all production call sites use the descriptor variant.Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.