mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[GH-ISSUE #8] Reduce Rust compile time and target artifact size #5
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#5
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?
Originally created by @LSX-s-Software on GitHub (Jul 27, 2026).
Original GitHub issue: https://github.com/kvcache-ai/AgentENV/issues/8
Background
Several common Rust build targets in AgentENV have become expensive to compile and produce very large artifacts. This affects local development feedback loops, CI runtime, disk usage, and the cost of switching between dev/test/release profiles.
A clean full rebuild is a useful way to expose the baseline cost, but the issue is broader than any particular local cleanup workflow. Even incremental builds can be slow when touching code inside the large root
agentenvcrate, and test builds produce multiple large binaries that quickly inflatetarget/.Local measurements
Environment: 16 cores, 31 GiB RAM,
rustc 1.97.0, current workspace.The test targets below were measured with
--no-runto isolate compile/link time from KVM, root permissions, network namespaces, or test runtime behavior.cargo build -p agentenv --bin server --timingscargo test -p agentenv --lib --no-run --timingscargo test -p agentenv --no-run --test integration --test orchestrator_integration --test snapshot_oss_e2e_test --timingscargo build --release -p agentenv --bin server --timingstouch src/local_store.rs && cargo build -p agentenv --bin servertarget/size after building the common dev/test/release targets:Large artifacts observed:
Release server size:
Timing hotspots
Cold dev server build top items:
Cold release server build top items:
Initial analysis
This does not appear to be caused by a single crate. The cost is the result of several factors compounding:
agentenvcrate is large and directly includes API, sandbox, snapshot, orchestrator, image, P2P, setup, and other subsystems. Touching code inside this crate can still require expensive incremental recompilation and relinking.librocksdb-sys,tikv-jemalloc-sys,aws-lc-sys,zstd-sys, andlz4-sys.agentenvdev-dependencies pull in benchmark and e2e dependencies. In particular,criterionandagentenv-test-supportcause ordinary unit-test builds to compile AWS SDK,aws-config,testcontainers, and related dependencies.agentenv, and around 75 duplicate crate names, includingreqwest 0.12/0.13,hyper 0.14/1.x,rustls 0.21/0.23,bindgen 0.69/0.72, andnetlink-packet-route 0.28/0.29/0.30.Proposed direction
This should probably be handled as a build-performance and dependency-governance effort, split across several PRs.
P1: Isolate benchmark and e2e dev-dependencies (Done in #39)
Move Criterion benchmarks and OSS e2e/test-support code into separate workspace packages so that
cargo test -p agentenv --libdoes not compile AWS SDK, testcontainers, or Criterion.Target: ordinary root-crate unit tests should not depend on:
criterionagentenv-test-supportaws-sdk-s3aws-configtestcontainerstestcontainers-modulesP2: Feature-gate P2P/Iroh
Make
irohandiroh-blobsoptional dependencies behind a feature such asp2p-iroh. Default dev/unit-test builds should not compile the Iroh backend. If config selects Iroh but the binary was built without the feature, return a clear error.P3: Feature-gate jemalloc
Make
tikv-jemallocatoroptional. Release/server distribution builds can enable it, but regular dev/test builds should not need to compile jemalloc by default.P4: Optimize or isolate RocksDB
Evaluate whether RocksDB can be built with fewer features or moved behind a feature/backend boundary.
librocksdb-sysis currently the largest full-rebuild hotspot, so reducing its feature set or isolating it from ordinary tests could have a large impact.P5: Consolidate HTTP/TLS dependencies
Review generated clients and root dependencies to avoid compiling both native-tls/OpenSSL and rustls/aws-lc/ring stacks where possible. Pay special attention to
thirdparty/firecracker-clientandthirdparty/envd/http-clientdefault features.P6: Split the root crate over time
Longer term, split the large root
agentenvcrate into smaller internal crates with clearer compile boundaries, e.g. config/types/image/snapshot/sandbox/orchestrator/p2p/server-app. This should improve incremental rebuild behavior and reduce the amount of code recompiled for localized changes.Suggested acceptance criteria
Possible measurable goals:
cargo test -p agentenv --lib --no-runno longer compiles AWS SDK, testcontainers, or Criterion.target/debug/incrementalafter the common dev/test workflow is substantially below the current 5G range.Notes
This is not a functional correctness bug, but it is a maintainability issue. It directly affects local iteration speed, CI cost, disk usage, and the ability to keep adding subsystems without making the workspace increasingly expensive to build.
@NickNYU commented on GitHub (Jul 29, 2026):
Hi
I have sent a PR trying to partially solve the problem, please see if it works @LSX-s-Software
Thanks