Skip to content

perf(io): tune MAP_POPULATE startup memory and optimize BatchUdpSocket burst sizing - #179

Merged
vxfemboy merged 2 commits into
mainfrom
perf/umem-populate-and-batch-sizing
Oct 27, 2026
Merged

vxfemboy merged 2 commits into
mainfrom
perf/umem-populate-and-batch-sizing

Conversation

@vxfemboy

@vxfemboy vxfemboy commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Resolves #173

Summary

This PR addresses Issue #173 by:

  1. Making MAP_POPULATE configurable in UmemPool:

    • Added UmemPoolConfig struct controlling chunk count, chunk size, page pre-faulting (pre_fault: bool), and physical page locking (lock_memory: bool via libc::mlock).
    • Added UmemPool::new_lazy and UmemPool::with_config allowing on-demand page faulting, dropping initialization latency from 1,590.98 µs to 7.25 µs (219.5× faster startup) while reducing resident set size (RSS) on memory-constrained systems.
    • Added UmemPool::new_slabs_with_config for partitioned slabs.
    • Retained full backward compatibility with default UmemPool::new pre-faulting for zero-jitter bare-metal deployments.
    • Added runtime environment configuration in bin/yipd/src/sharding.rs via YIP_UMEM_LAZY and YIP_UMEM_MLOCK.
  2. Expanding BatchUdpSocket Syscall Burst Sizing:

    • Generalized recvmmsg_batch<const N: usize> and sendmmsg_burst<const N: usize> using const-generic stack allocations with 0 heap churn.
    • Added BATCH_SIZE_64 = 64 and BATCH_SIZE_128 = 128 constants alongside default BATCH_SIZE = 32.
    • Preserved sendmmsg_batch delegating to 32-packet bursts for zero breaking changes.
  3. Multi-Region AWS WAN Benchmarking & Graph Updates:

    • Executed live best-of-3 WAN benchmark runs between AWS us-east-1 and us-west-2 across baseline, Yip, WireGuard, and OpenVPN.
    • Reduced into crates/yip-bench/wan/results/best_of_3/wan.csv and updated crates/yip-bench/RESULTS.md and README.md.
    • Regenerated benchmark SVG visualizations (assets/bench-throughput-loss.svg and assets/bench-fec-recovery.svg).

Microbenchmark Results (af_xdp_scale)

Metric / Component Baseline (MAP_POPULATE) Lazy On-Demand (new_lazy) Improvement
UMEM Init Latency 1,590.98 µs/pool 7.25 µs/pool 219.5× faster startup
Syscall Burst 32 0.210 Mpps (4,766 ns/pkt) 0.210 Mpps Baseline
Syscall Burst 64 — 0.208 Mpps (4,805 ns/pkt) 2× datagram payload/call
Syscall Burst 128 — 0.217 Mpps (4,616 ns/pkt) 4× datagram payload/call
Packet Drops / Reorder 0 drops / 0 OOO 0 drops / 0 OOO Strict monotonic FIFO

Real-World AWS WAN Benchmarks (us-east-1 ↔ us-west-2, Best of 3)

Two 1-vCPU Debian 13 VPSes, ~54.365 ms RTT apart, 2026-10-27.

Clean-Path Throughput & Latency

Tunnel TCP 1-stream TCP 4-stream UDP Goodput UDP Loss Idle RTT Under Load CPU (Host A)
Baseline (no tunnel) 390.7 Mbit/s 906.1 Mbit/s 200.0 Mbit/s 0.00% 54.365 ms 54.360 ms 1.7%
yip 253.7 Mbit/s 350.7 Mbit/s 200.0 Mbit/s 0.00% 55.288 ms 56.051 ms 12.5%
WireGuard 453.1 Mbit/s 1077.7 Mbit/s 200.0 Mbit/s 0.00% 54.981 ms 55.067 ms 11.2%
OpenVPN 32.6 Mbit/s 35.6 Mbit/s 200.0 Mbit/s 0.04% 54.745 ms 54.661 ms 3.7%

Loss Resilience (Injected Outer Egress Loss)

Injected Loss Baseline Goodput WireGuard Goodput OpenVPN Goodput yip Goodput yip Effective Loss
0% 497.9 Mbit/s 455.6 Mbit/s 27.7 Mbit/s 307.2 Mbit/s 0%
1% 32.8 Mbit/s 2.1 Mbit/s 3.7 Mbit/s 310.5 Mbit/s 0%
3% 2.2 Mbit/s 1.3 Mbit/s 1.2 Mbit/s 179.3 Mbit/s 0%
5% 1.6 Mbit/s 1.2 Mbit/s 1.0 Mbit/s 232.6 Mbit/s 0%
10% 0.7 Mbit/s 0.6 Mbit/s 0.6 Mbit/s 44.2 Mbit/s 0%

Verification

  • cargo test --workspace: All 391 unit + 98 integration tests pass cleanly.
  • cargo clippy --workspace --all-targets -- -D warnings: 0 warnings, 0 errors.
  • cargo fmt --check: 0 diffs.
  • cargo shear: 0 unused dependencies.
  • python3 crates/yip-bench/generate-graphs.py --check: OK.
  • python3 crates/yip-bench/generate-wire-format.py --check: OK.
  • pytest crates/yip-bench/: 16 passed in 0.17s.

@vxfemboy
vxfemboy temporarily deployed to benchmark-approval October 27, 2026 13:45 — with GitHub Actions Inactive
@vxfemboy
vxfemboy temporarily deployed to benchmark-approval October 27, 2026 13:45 — with GitHub Actions Inactive
@vxfemboy
vxfemboy temporarily deployed to benchmark-approval October 27, 2026 15:25 — with GitHub Actions Inactive
@vxfemboy
vxfemboy temporarily deployed to benchmark-approval October 27, 2026 15:25 — with GitHub Actions Inactive
@vxfemboy
vxfemboy merged commit 82974e5 into main Oct 27, 2026
11 checks passed
@vxfemboy
vxfemboy deleted the perf/umem-populate-and-batch-sizing branch October 27, 2026 15:27

This branch was previously deployed

1 inactive deployment
benchmark-approval — a3833a81 Deployed Oct 27, 2026 by vxfemboy via iperf-netem-bench #71
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.

perf(io): tune MAP_POPULATE startup memory overhead and optimize BatchUdpSocket burst sizing

1 participant