Skip to content

Lesson 7 of 9 · 26m

WireGuard Performance and Throughput

What actually limits WireGuard speed — CPU, encryption offload, interrupts, MTU, buffers, UDP drops, cloud networking — and how to benchmark without fooling yourself.

WireGuard is fast, but “fast” is not a capacity plan. Throughput depends on CPU cycles, kernel scheduling, NIC behavior, UDP loss, MTU, and the network path. In production, the bottleneck is rarely the cryptographic primitive in isolation; it is the interaction between encryption work and packet plumbing.

Benchmark the thing you operate

Synthetic cryptographic benchmarks are not service benchmarks. Measure with real packet sizes, real parallelism, and the actual path:

$ iperf3 -s --bind 10.44.1.2
$ iperf3 -c 10.44.1.2 -P 8 -t 30
$ iperf3 -c 10.44.1.2 -u -b 2G -l 1400

Test TCP and UDP. TCP hides packet loss by retransmitting and then backing off; UDP exposes loss and queueing behavior directly. A tunnel that reaches 5 Gbit/s in one direction on bare metal may collapse to 400 Mbit/s on a small cloud instance with limited vCPU or constrained virtual networking.

CPU is usually the first wall

ChaCha20-Poly1305 is efficient in software, but every payload byte still costs CPU. On Linux, WireGuard work is spread across kernel threads, yet single-flow performance can still be constrained by softirq and per-peer processing. Watch CPU pressure while testing:

$ mpstat -P ALL 1
$ top -H
$ cat /proc/softirqs

If one core saturates while others idle, increasing bandwidth or adding tunnels will not help. You need distribution across peers/flows, faster cores, offload improvements, or horizontal scaling.

MTU mistakes tax every packet

An oversized tunnel MTU causes fragmentation or blackholes. Fragmentation wastes CPU and makes loss amplification worse: lose one fragment, lose the whole original packet. Set MTU deliberately and verify path behavior.

$ ip link set dev wg0 mtu 1420
$ ping -M do -s 1372 -c 4 10.44.1.2

Inside cloud networks, the physical interface MTU may not be 1500 even when the instance claims it is. Verify the underlay, especially when nested virtualization or another overlay is present.

UDP is subject to policing

WireGuard uses UDP. Some ISPs, cloud providers, and middleboxes rate-limit UDP, deprioritize it under congestion, or use state timeouts that interact badly with idle peers. A “slow VPN” may be a fast TCP test because TCP receives different treatment.

Measure packet loss and reordering, not just throughput. Tools such as mtr, iperf3 -u, and interface counters tell different parts of the story:

$ ip -s link show dev wg0
$ ethtool -S eth0

Buffers and coalescing trade latency for throughput

High interrupt coalescing can increase throughput while adding latency, and large socket buffers can hide queueing delay until applications feel it as jitter. Inspect net.core.rmem_max, net.core.wmem_max, and ethtool -c eth0 only after measuring; a value that helps a 10 Gbit/s relay can hurt a low-powered edge gateway.

Encryption is not your only overhead

Connection tracking, firewall rules, NAT, qdiscs, XDP programs, and observability agents all sit in the forwarding path. If a gateway is slow, isolate by testing endpoint-to-endpoint crypto performance, then forwarding through the gateway, then traffic from LAN clients. The difference tells you where the cost lives.

Field notes

  • Never benchmark through a Wi-Fi client and declare the gateway slow.
  • Parallel streams can mask single-flow limitations; test both.
  • Cloud egress bandwidth and instance network caps often matter more than cipher speed.
  • Watch retransmissions and UDP errors, not just final throughput numbers.
  • Capacity-plan gateways using peak concurrent user traffic plus failure-headroom, not idle-day averages.

Was this lesson helpful?

Sign in to rate