mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #307] [CLOSED] perf(server): avoid blocking startup on firecracker pool prime #334
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#334
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/307
Author: @emailcannotbeblank
Created: 9/20/2026
Status: ❌ Closed
Base:
main← Head:fix/async-firecracker-pool-prime📝 Commits (1)
45c72a1perf(server): avoid blocking startup on firecracker pool prime📊 Changes
2 files changed (+7 additions, -3 deletions)
View changed files
📝
scripts/install.sh(+2 -0)📝
src/bin/server.rs(+5 -3)📄 Description
What
This PR makes two changes:
FirecrackerPool::prime()throughtokio::spawnduring server startup, so Firecracker pool warm-up does not block the subsequent API startup.ExecStartPostcommand to the systemd service generated byscripts/install.sh. It polls/healthevery 100 ms and waits until the AgentENV service is actually ready.Why
Test environment
Problem
After running
systemctl restart aenvand waiting for eight seconds, the AgentENV API was still not ready:Cause
In the
mainfunction insrc/bin/server.rs, server startup synchronously waits for the Firecracker pool to be primed:This step takes a significant amount of time with the test configuration above. The AgentENV API does not become available until execution reaches the following code and binds the listening address:
At the same time, the original systemd service does not wait for the HTTP API to become ready. Therefore, the systemd command returning does not mean that
aenvcan already access the API.Related issue
N/A. No existing issue was found that directly tracks this startup-blocking behavior.
Scope and non-goals
This PR includes:
/healthfrom the systemd service generated by the installer.This PR does not include:
low_watermarkorhigh_watermark.Design and behavior changes
1. Wait for service readiness in systemd
Add the following command to the service file generated by
scripts/install.sh:The command checks
/healthevery 100 ms.systemctl start aenvreports success only after the health check succeeds. It reports failure if all 900 attempts fail.With the health check added, but before making pool priming asynchronous, service startup took:
2. Prime the Firecracker pool asynchronously
Replace the synchronous wait with:
The Firecracker pool continues warming in the background while the main flow proceeds with API startup.
After this change, the time for
systemctl start aenvto observe a successful/healthresponse was:Compatibility and operations
src/bin/server.rsandscripts/install.shto restore the previous behavior.curland the existingAPI_ADDRfrom the service environment file.Validation
make fmtmake clippymake test-unitmake -C services test(passed; this PR does not changeservices/)Commands and results:
Skipped checks and reasons:
make test-e2etarget was not run.Integration-test notes:
make test-agent-integrationwas run, but the full command failed becausefc::microvm_network_policy_controls_egressreceivedcurl: (52) Empty reply from serverfrom an external site. The integration-test checkbox therefore remains unchecked.orchestrator_integrationand the snapshot OSS integration tests were run separately and all passed.9103, soAENV_UBLK_DAEMON_METRICS_LISTEN_ADDR=''was set only for the test process. The existing service was not changed or stopped.Risks and reviewer notes
Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.