perf: yip-wire SipHash header-auth is ~9% of receiver CPU under load — investigate/optimize #58
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
femboy/yip#58
Loading…
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?
The post-4a
perfre-profile (bulk traffic, 1-core AMD EPYC target box) surfaced theyip-wirecoverage-auth SipHash (Sip24) as ~9% of receiver CPU — a surprising userspace hotspot, second only to the kernel TUN-write path (~20%) and well above AEAD decrypt (~4.4%) and RS FEC decode (~1.6%).See
crates/yip-bench/RESULTS.md(the 4b re-profile section) for the profile.Investigate
Constraints
Investigation (2026-07-12): traced the pipeline — SipHash-2-4
auth_tagruns over the full ~1400-byte FEC symbol per packet (~9% receiver CPU). It is NOT redundant with the AEAD: order is encrypt → FEC-encode ciphertext → per-symbol SipHash; on receive deframe(verify SipHash) → FEC-decode → AEAD-decrypt. The SipHash authenticates each FEC symbol before the decoder, keeping forged/corrupted symbols out of reassembly (load-bearing for loss recovery) + cheap-reject + anti-DPI. So we can't shrink it to the header — a faster MAC over the same bytes is the only lever. Options: SipHash-1-3 (~2×, minor margin cut), keyed BLAKE3 (SIMD, constant-time, no AES-NI). AES-NI MAC rejected on principle (reintroduces the AES-NI dependency + software-AES timing side channel that yip chose ChaCha20 to avoid). Parked as low-yield on current hardware: ~4.5% best-case CPU saving that does NOT move end-to-end throughput on the RTT/window-capped target boxes (same lesson as 4b), for a wire-format change to security-critical code. Revisit if/when a box is genuinely MAC-bound.Spike done — measured both candidates on the EPYC target box (PR #114)
Isolated keyed-MAC microbench over the exact covered region (header‖symbol, 8-byte tag), on the EPYC 4b-profile box and a dev box — ratios agree:
Findings
Decision: stay parked. The ~4% receiver-CPU saving is real but does not move end-to-end throughput on the RTT/window-capped boxes (same lesson as 4b), and it would mean a reduced-round MAC on security-critical wire code. Not worth it now.
Revisit trigger: a genuinely MAC-bound (CPU-bound, not RTT-bound) receiver — e.g. short-RTT/LAN paths or enough parallel sessions to saturate a core. The bench (
crates/yip-bench/benches/mac_candidates.rs) stays as the decision artifact + regression guard; re-run it on the candidate box before reopening.Correction / follow-up: the "doesn't move throughput" line was regime-specific
The decision above rests on "the ~4% saving does not move end-to-end throughput on the RTT/window-capped boxes." A CPU-bound-regime spike run afterward (PR #115) shows that premise is regime-specific to the 24 ms single-flow WAN path, not general:
So in short-RTT / regional / aggregate-parallel deployments the receiver is CPU-bound, and there the ~4% MAC saving ≈ +50 Mbps and codec-path wins scale directly. #58 stays parked (SipHash is third-tier behind TUN-write and AEAD), but the reason is "not the biggest lever," not "CPU never matters." See
crates/yip-bench/cpu-bound-regime.md.