Skip to content

test(case2): real two-process socket + real-network cross-host confirmation - #124

Merged
cursor[bot] merged 7 commits into
mainfrom
AgentMemory/case2-socket-netem-2815
Jun 14, 2026
Merged

test(case2): real two-process socket + real-network cross-host confirmation#124
cursor[bot] merged 7 commits into
mainfrom
AgentMemory/case2-socket-netem-2815

Conversation

@FluffyAIcode

@FluffyAIcode FluffyAIcode commented Jun 14, 2026

Copy link
Copy Markdown
Owner

What

Solidifies Case 2 (ADR 0014) with real two-process socket + real-network measurements and a direct-gRPC transport comparison, replacing the injected-sleep RTT model.

  • scripts/research/socket_echo_server.py — raw-TCP echo (remote-host boundary).
  • scripts/research/grpc_echo_probe.py — raw-bytes gRPC echo + RTT probe.
  • scripts/research/k3_specdecode_gpu_bench.py--socket-echo-addr (raw) and --grpc-echo-addr (gRPC) per-block real round-trip of the actual ≈156 KB aux payload.

Results (H200 NVL, real models, real network)

transport / path 156 KB RTT fused tok/s vs AR
co-located (no network) 47.0 1.85–2.20×
loopback gRPC (same host) 1.1 ms
raw socket over ~102 ms path 207 ms 14.1 0.56×
direct gRPC over ~102 ms path 208 ms 15.95 0.63×
  • gRPC vs raw socket: gRPC is modestly better (0.63× vs 0.56×; ~197 vs ~232 ms/block) — it serializes the 156 KB more efficiently — but still a net loss. The ~102 ms geographic RTT dominates, not the transport.
  • gRPC's real value is at loopback (1.1 ms for 156 KB) → on a low-RTT link the transport is free and the engine returns to its 1.8–2.2× win. This is "LAN = data plane".

On the ~102 ms (clarification)

It is not a gRPC RTT and not a floor — it's a raw round-trip between two different-region hosts (+ SSH-relay overhead). Decomposed: 64 B → 102.6 ms (pure inter-region latency); 40 KB–156 KB flat at ~206 ms (an extra round-trip, not bandwidth).

Optimization levers (= the architecture's prescription): (1) latency — co-locate the draft loop (same region 5–20 ms, LAN 0.5–2 ms, Thunderbolt sub-ms; ≤15 ms → 1.8–2.2×); (2) transport — gRPC/QUIC (free at low RTT, modest help at high RTT); (3) payload — fp8/int8/top-k cuts the 156 KB 2–4×; (4) fewer round-trips — larger blocks.

Environment notes: tc netem is blocked in the vast container (no NET_ADMIN); the non-SSH vast mapped ports accept SYNs but don't forward data, so real latency came from a real inter-host SSH path (the true direct-gRPC number would be ≤ the tunneled one). Documented in ADR 0014 §4.4.

Files

  • scripts/research/{socket_echo_server,grpc_echo_probe}.py (new)
  • scripts/research/k3_specdecode_gpu_bench.py (--socket-echo-addr, --grpc-echo-addr, --netem-sweep)
  • docs/adr/0014-…md §4.3/§4.4 + README.md
  • results/research/k3_crosshost_{realnet,socket_loopback,grpc}_gpu.json

Testing

  • ✅ Loopback gRPC on H200 (156 KB → 1.1 ms); co-located fused 1.85–2.20× AR.
  • ✅ Real-network (~102 ms) over reverse SSH path: raw socket 0.56× AR, direct gRPC 0.63× AR.
  • ✅ RTT decomposed by payload (64 B → 102.6 ms; 156 KB → 206–208 ms) for both raw + gRPC.
  • ⚠️ tc netem + non-SSH direct ingress unavailable in the vast container — used a real inter-host path instead.
Open in Web Open in Cursor 

cursoragent and others added 7 commits June 14, 2026 03:35
socket_echo_server.py: length-prefixed TCP echo = the remote-host network
boundary. k3_specdecode_gpu_bench.py --socket-echo-addr round-trips the REAL
per-block aux payload (verifier->proposer hidden states + draft tokens) through
the socket once per block; --netem-sweep applies real tc netem latency on the
loopback between runs. Replaces the injected-sleep RTT model with a true
two-process socket + real-network measurement to corroborate the WAN-penalty curve.

Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
Added socket_echo_server.py (remote-host boundary) + --socket-echo-addr socket
round-trip of the REAL per-block aux payload (~156KB/block) in the fused engine.
tc netem is blocked in the vast container (no NET_ADMIN), so real latency came
from a real inter-host link (reverse SSH tunnel, ~102ms RTT):
  loopback (~0ms):  51.5 tok/s = 2.02x AR
  real net (~102ms): 14.1 tok/s = 0.56x AR  (net loss; network = 71% wall time)
End-to-end real-models + real-network proof that the cross-host token-level
draft data plane is WAN-infeasible. Updated ADR 0014 + README.

Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
… a floor); RTT decomposition + optimization levers

Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
… tunnel)

Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
…lock round-trip

Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
gRPC echo probe (grpc_echo_probe.py) + --grpc-echo-addr fused-loop transport.
Direct-gRPC over the real ~102ms path: 15.95 tok/s = 0.63x AR (vs raw-socket
0.56x) — modestly better (efficient 156KB serialization) but still a net loss;
the ~102ms geographic RTT dominates, not the transport. Loopback gRPC 156KB =
1.1ms, so on a low-RTT link gRPC is free and the 1.8-2.2x win returns. (True
non-SSH ingress blocked by vast forwarder; gRPC ran over the same SSH path.)
Fixed net_bytes_per_block reporting for the grpc path.

Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
…map, and one-line verdict (Case 1 + Case 2)

Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
@cursor
cursor Bot marked this pull request as ready for review June 14, 2026 04:38
@cursor
cursor Bot merged commit 5cf79e1 into main Jun 14, 2026
8 checks passed
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