Prove 10k agents share per-node Streams sessions

Merged
VA
3d ago
+355-0

Adds the streams-only 10k-agent qualification: 10,000 agents exchange records with their peers through 10,000 atomic two-stream transactions. One client follows every agent stream and verifies all 20,000 deltas, contiguous offsets, exact sender identities and no duplicate delivery.

The eight-node scenario uses the public Rust SDK client and actual TCP Session RPCs. The client holds one connection to node 0; node 0 fans in through seven pooled node-pair sessions. Every node asserts exactly one physical connection and one Session RPC, independently of its follow count. The client edge carries 10,000 follows; each other node carries 1,250. Every endpoint asserts zero actor socket/call channel opens (kinds 13/14).

Restacked onto main after #650 and #690 merged. Signed head: 69607db970bfa5f63b375584bbd5bb92488face6. The diff remains confined to two test files; no production transport is added.

Validation

  • Windows lb.ps1 cargo check --locked -p acyclic-stream --features local,http --lib --tests passes in 5.50 s.
  • Linux: built only the focused acyclic-stream library test target through bs.ps1, then ran the built binary directly. Both 10,000-agent scenarios and both negative controls pass: 3 tests in 3.08 s (3.129 s process time). The agent count is never reduced. The eight-second deadline is a deadlock watchdog; latency has no wall-clock pass threshold.
ScenarioAgentsDeltasp50p99
In-process MemoryStream10,00020,000101.879 ms165.536 ms
Eight-node loopback Streams service10,00020,0002.276 ms4.445 ms

Each delta carries its transaction-start timestamp; measurement ends when the client yields it. These figures include acceptance, scheduling and queueing on shared bb1. The scenarios have different execution schedules; the table does not measure network overhead or a before/after transport speedup. No deployed-cloud result is claimed.

Connection assertions: client=1, node-pair=7, total=8; each node=1; actor channels=0. Completion count is exactly 10,000 agents. Each agent receives its own and its peer's committed record once, at offsets 1 and 2. Final log: /home/var/log/buildbox/2026-10-16T100621020Z-3427073.log.

The production transport is unchanged. Every encoded Session message in both directions is charged its full protobuf size plus its five-byte uncompressed gRPC prefix, including control and teardown frames. The qualification waits for each server Session stream to retire before checking the final counters. Each node is limited to 256 + 1024 * follows bytes for this fixed two-record workload. The edge used 3,039,619 bytes for 10,000 follows (budget 10,240,256); each owner used 380,410–380,437 bytes for 1,250 follows (budget 1,280,256). HTTP/2/TCP overhead is excluded.

Both controls run against the same fixture and use the exact same node_work verifier as the 10k test:

  • Four independent SDK clients open four Sessions over one shared TCP connection. The verifier rejects sessions per node at four follows, without timeout or resource exhaustion.
  • A shared client receives redundant valid zero-credit controls; normal record delivery still succeeds. The verifier rejects bytes per follow, while session/connection/follow/actor counts remain valid. Each control publication is awaited so the fixture queue never overflows.

Decisions

  • Agents communicate only through StreamProvider transactions and follows. There is no Actors socket, virtual channel, harness service or gateway dependency. The edge is a simulated Streams node using the same SDK provider for node-level subscription fan-in.
  • Each agent performs one small exchange, preserving the full 10,000 agents. An independent producer task gives producer and consumer their own runtime cooperative budgets.
  • Reuse the authenticated TCP/Session fixture and counters. No duplicated server, parser, lock, reducer or application store is added. Existing real-code models cover production synchronization; this integration workload does not replace them.
  • Harness/UI state remains files in volumes. This test qualifies the Streams transport beneath live file queries, without introducing application messages or state.

Live steps

Deployed endpoint measurements, tier transitions through materialized file heads, attention preservation and UI CPU/memory qualification remain integration work. This PR proves connection count, delivery completeness and delta latency for the 10k transport workload.