mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #112] [CLOSED] chore(scripts): add API benchmark and smoke scripts #189
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#189
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/112
Author: @cleverhu
Created: 8/3/2026
Status: ❌ Closed
Base:
main← Head:chore/api-bench-scripts📝 Commits (1)
a402b96chore(scripts): add API benchmark and smoke scripts📊 Changes
3 files changed (+954 additions, -1 deletions)
View changed files
📝
Makefile(+8 -1)➕
scripts/bench.py(+727 -0)➕
scripts/smoke.py(+219 -0)📄 Description
What
Add
scripts/bench.py(API-level lifecycle benchmark),scripts/smoke.py(post-deploy smoke test through the E2B SDK), and amake bench-apitarget.Why
The repository has Criterion benchmarks for storage internals, but nothing that measures what a user actually experiences: the latency and throughput of create / pause / resume / snapshot / fork over the HTTP API, under concurrency.
That gap is not academic. Measuring through the E2B Python SDK, a create that the server completed in ~85 ms was reported as 137 ms, because the SDK lazily constructs an
httpx.Clientper subsystem and each construction spends ~37 ms building a default TLS context — on a plain-HTTP link. Without a tool that drives the API directly, that overhead is indistinguishable from server latency.Related issue
None; tooling addition with no runtime impact.
Scope and non-goals
Included: the two scripts and the make target.
Excluded:
Design and behavior changes
bench.pyis standard library only and speaks HTTP directly, so no SDK sits in the measurement loop.create-onlyandcreate-deletemodes; p50/p95/p99, wall time and amortized per-op time; JSON export retaining raw samples in completion order so drift over a run is visible.--metrics-url, it diffs a node's Prometheus endpoint across the measured window and prints the server-side stage breakdown (load_snapshot,create_sandbox, ublk operations) next to client latency. This is what makes it possible to say "the storage layer is 3 ms of the 85 ms" rather than guessing.smoke.pyruns the lifecycle through the official E2B SDK and times each step, which is the fastest way to confirm a deploy is healthy and E2B compatibility still holds.Both default to
http://127.0.0.1:8000and readAENV_API_URL/AENV_API_KEY/AENV_TEMPLATE_ID(or theE2B_*equivalents) from the environment.Compatibility and operations
BENCH_API_SCENARIOandBENCH_API_ARGSare Makefile variables only.bench.pyneeds only Python 3.smoke.pyadditionally needspip install e2b. Neither is imported by the build.Validation
make fmtmake clippymake test-unitmake -C services test(required whenservices/changes)maketargetCommands and results:
An earlier revision of
bench.pyproduced this on an internal 128-core host, template 2 vCPU / 1 GiB,create-onlymode — included to show the shape of the output rather than as a claim about upstreammain:The degradation above ~10 concurrent creates tracks warm-pool exhaustion: with
[pool] low_watermark = 2the pool empties immediately and most requests fall to the cold path (fresh netns, fresh ublk device, cold Firecracker). That is a finding this tool surfaces, not something this PR changes.Skipped checks and reasons:
make -n.Risks and reviewer notes
No runtime risk; nothing here is reachable from the server binary.
Reviewer notes:
smoke.pyrequirese2bfrom PyPI, which is not vendored. Please confirm an optional dependency inscripts/is acceptable.bench.py's metric table are coupled to the currentSandboxStageTimerlabels and will need updating if those are renamed.Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.