Skip to content

feat: host-level data path performance tuning - #2

Merged
achetronic merged 1 commit into
masterfrom
feat/host-tunning-section
Jun 24, 2026
Merged

feat: host-level data path performance tuning#2
achetronic merged 1 commit into
masterfrom
feat/host-tunning-section

Conversation

@achetronic

@achetronic achetronic commented Jun 24, 2026

Copy link
Copy Markdown
Owner

New spec.host block on the EdgeNode to tune the VPS itself (kernel and NIC), separate from the Envoy proxy config. It comes from debugging a tunnel-in-tunnel setup where throughput was poor and Envoy was dropping UDP datagrams.

What you get

  • host.kernelMaxSocketBufferBytes (default 25MB): one value that raises the kernel socket buffer ceiling (net.core.rmem_max/wmem_max) and sets SO_RCVBUF/SO_SNDBUF on the UDP listeners. UDP needs this set explicitly; TCP keeps autotuning on its own. Useful for high-throughput or encapsulated UDP that otherwise loses packets under load.

  • host.disableNicOffloads (default false): turns GRO/GSO off on the public NIC. Leave it off for normal traffic, where the offloads help. Turn it on for encapsulated UDP (tunnel-in-tunnel), where GRO merges packets it shouldn't and corrupts datagram boundaries, which is what was crashing Envoy. The interface is detected automatically.

Also in here

  • Dropped prefer_gro from the Envoy UDP listeners and set enable_reuse_port on all of them, so they spread across worker threads.
  • Renamed the boot service wg-relay.service to tunnel-boot.service, since it now reapplies the whole node config on boot, not just WireGuard. The WireGuard interface is still called wg-relay.
  • Offloads are applied without shelling out to ethtool, the same way WireGuard and nftables are already handled, so nothing extra needs to be installed on the VPS.

Adds one dependency, github.com/safchain/ethtool (Apache-2.0).

Add spec.host on EdgeNode to tune the VPS as a machine, independent of
the proxy.

Features:
- spec.host.kernelMaxSocketBufferBytes (default 25MB): single knob wired
  to net.core.rmem_max/wmem_max and to SO_RCVBUF/SO_SNDBUF on the Envoy
  UDP listeners (UDP does not autotune; TCP is left to autotune).
- spec.host.disableNicOffloads (default false): turn GRO/GSO off on the
  underlay NIC (auto-detected via netlink route lookup), applied natively
  over ethtool-netlink as a netdev section of the relay document.

Changes:
- render: drop prefer_gro, set enable_reuse_port on every listener.
- agentconfig: optional netdev section in the desired-state document.
- internal/netdev: native ethtool applier with an IO seam and a
  root-gated test.
- rename the boot oneshot wg-relay.service to tunnel-boot.service (the
  WireGuard interface wg-relay is unchanged).
@achetronic achetronic self-assigned this Jun 24, 2026
@achetronic achetronic added the enhancement New feature or request label Jun 24, 2026
@achetronic achetronic assigned achetronic and unassigned achetronic Jun 24, 2026
@achetronic
achetronic merged commit 701a60f into master Jun 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant