throughput 4c: MTU-aware packetization to cut packet count (fewer per-packet syscalls / TUN / SipHash) #59
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#59
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?
Lever 4c of the single-core throughput campaign (4a send GSO ✓ #55, 4b TUN offload ✓ #56).
The post-4a/4b profiling showed the single-core ceiling is per-packet cost (kernel UDP send
sendmsg~23%, TUN write ~20%, SipHash ~9% — all charged per packet). Raising the tunnel MTU cuts the packet count for the same bytes, so it reduces every per-packet cost proportionally — the cheapest, most broadly-applicable remaining lever.Scope
Note
Investigation complete (2026-07-22): levers measured and bounded
Ran a measurement-first spike (real
Transport::encodepath + netns) before committing to a mechanism. Full write-up:docs/research/2026-07-22-mtu-packetization-findings.md. Summary:The send path, and where the cost is
inner → +16 AEAD → FEC symbols (size 1200, **last zero-padded to full symbol_size on the wire**) → +23 wire frame → +11 obf → +28/48 IP/UDP. Two cost tiers: per-inner-packet (AEAD, TUN-write — the two biggest) and per-symbol (sendmsg ~23%, SipHash ~9%, framing).yipddoes not currently set the TUN MTU (kernel default 1500); the QUIC MtuDiscovery is only the mimicry transport, not the data plane.Finding 1 — wire padding makes
symbol_sizedouble-edgedEvery FEC symbol is zero-padded to full
symbol_sizeon the wire (fec.rs"last zero-padded"; reassembler rejectsdata.len() != symbol_size; framer sends it untrimmed). So a blindsymbol_sizeincrease is a bandwidth regression for small packets (a 576 B packet at symbol_size 9000 → two 9000 B symbols, 3047% overhead).Finding 2 — two MTU levers, very different reach
The issue's premise ("raising MTU reduces every per-packet cost proportionally") holds only for Lever 2.
Finding 3 — the FEC-rate lever is a MIRAGE (load-bearing, not waste)
The bench's "2.00 symbols/packet" turned out to be the permanent steady state of the Default class (DSCP 0 = ~all traffic): non-ARQ,
min_ratiofloors at 0.10, so it emits 1 source + 1 repair forever, even on a pristine link. Tempting to decay it to 0. Measured the experiment (floor→0):non_arq_class_keeps_floor, a deliberate tested invariant. The floor protects exactly the low-rate latency-sensitive traffic (SSH/DNS/VoIP/gaming) the class exists for.Conclusion: the current FEC tuning is correct; do not pursue the FEC-rate change.
Net recommendation
The only defensible remaining work is static configurable MTU + last-symbol wire-trim (Finding 4: pad for the GF math, trim the partial last symbol on the wire — removes Lever 1's padding penalty), worthwhile for controlled/LAN/jumbo deployments, not worth the codec risk for internet-only paths. Suggest either closing this as investigated (revisit for a controlled-path deployment) or descoping to the static-MTU + wire-trim work filed for when it pays.