Skip to content

perf(agent): bound the generation-6 copy path - #1358

Open
appcypher wants to merge 4 commits into
releases/v0.7.0from
appcypher/agent-copy-foundation
Open

perf(agent): bound the generation-6 copy path#1358
appcypher wants to merge 4 commits into
releases/v0.7.0from
appcypher/agent-copy-foundation

Conversation

@appcypher

@appcypher appcypher commented Aug 16, 2026

Copy link
Copy Markdown
Member

TL;DR

Bound the existing agent transport and remove redundant copies before changing the wire protocol.

Description

  • Bound payload-bearing queues across agentd, the relay, and the console backend.
  • Move owned buffers through the pipeline instead of cloning and restaging whole frames.
  • Wake blocked console producers when ring capacity returns instead of polling.
  • Keep the generation-6 wire format and existing SDK surface unchanged in this PR.

The same fresh exact-head comparison is shown on every PR in this stack. “After” means all four PRs together at 7f3f44ce, with automatic dual-port selection and local-shm-v1 enabled; the original baseline is 05f53e7a. Both profiles ran twice in ABBA order.

Workload Original baseline Complete stack Change
FS host to guest, 256 MiB 153.5 MiB/s 323.4 MiB/s +110.6%
TCP host to guest, 64 MiB 198.8 MiB/s 210.1 MiB/s +5.7%
FS guest to host, 256 MiB 254.6 MiB/s 564.9 MiB/s +121.9%
TCP guest to host, 64 MiB 511.8 MiB/s 649.7 MiB/s +26.9%
TCP full duplex, 64 MiB each way 244.4 MiB/s 381.8 MiB/s +56.2%
Idle ping median 0.1383 ms 0.1471 ms +0.0088 ms
Ping under FS load, p95 480.3 ms 1.929 ms 99.60% lower

Environment: OVH Advance-4, Linux/KVM, 1-vCPU guest, host CPU 8 affinity, guest tmpfs, public Rust SDK, verified payload hashes, and empty stderr. After artifacts were rebuilt from 7f3f44ce against libkrun ff087a1.

Test Plan

  • Protocol, relay, console, SDK, and lint suites pass
  • Run the same baseline-versus-complete-stack Linux transport benchmark shown across all four PRs

Stream guest-to-host copies into atomic temporary destinations and move owned buffers through the SDK, relay, console, and agentd without redundant full-frame staging.

Replace payload-bearing unbounded queues and polling loops with byte-accounted admission, bounded channels, capacity wakeups, cursor-based decoding, and short-write-safe vectored output while preserving the generation-6 wire format.
@appcypher
appcypher requested a review from toksdotdev as a code owner August 16, 2026 04:44
Copilot AI lite review requested due to automatic review settings August 16, 2026 04:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread sdk/rust/lib/sandbox/fs.rs Outdated
Comment thread crates/agentd/lib/session.rs
Use the same bounded temporary-file streaming path on Windows and Unix instead of rejecting a previously supported SDK operation.

Let tempfile publish the completed sibling file atomically on each platform, preserve existing permissions, and keep Unix-specific mode and symlink assertions scoped to Unix tests.
Copilot AI review requested due to automatic review settings August 16, 2026 04:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Resolve the libkrun console APIs from the exact signed prerequisite revision so the cross-repository PR stack compiles in CI before the crates.io release.

Compile the partial-fragment helper only on Unix, where the custom console backend uses it, to keep Windows clippy free of dead code.
Copilot AI review requested due to automatic review settings August 16, 2026 09:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Import bytes::Buf only where the Unix custom console backend compiles its partial-fragment reader, keeping Windows clippy free of unused imports.
Copilot AI review requested due to automatic review settings August 16, 2026 09:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@appcypher
appcypher changed the base branch from main to releases/v0.7.0 August 25, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants