A tunnel is one more layer of nesting: your packet, encrypted and authenticated, inside another packet. WireGuard and OpenVPN put it inside UDP; SSH puts it inside a TCP connection. Each choice has a price in bytes, in CPU and in what happens when the network drops packets. This benchmark measures that price for five tunnels and two cipher choices, against the same traffic with no tunnel at all.
Everything was measured on one machine, between containers joined by virtual Ethernet, with the link in the middle emulated by tc netem. Every bulk transfer was checked byte for byte and by SHA-256, and every latency probe compared its echo: 2,740 MiB and 26,000 round trips, 0 corrupted.
Setup
Details
WireGuard
Linux kernel module (kernel 7.0), wireguard-tools 1.0.20210914 · wireguard-go 0.0.20250522, the userspace implementation, measured as its own row, never in place of the kernel
OpenVPN
2.6.14 (OpenSSL 3.5), UDP, point-to-point TLS mode with --peer-fingerprint (self-signed P-256 certificates, TLS 1.3 control channel), data channel AES-256-GCM or ChaCha20-Poly1305, userspace data path (--disable-dco: the kernel’s data-channel-offload module was not loaded on the host)
SSH
OpenSSH 10.0p2, Ed25519 keys, compression off · port forwarding (ssh -L) with aes256-gcm@openssh.com or chacha20-poly1305@openssh.com · layer-3 tunnel (ssh -w, a TUN device at each end) with AES-256-GCM
Network
Three containers with no network of their own: client, router, server, joined by two virtual Ethernet pairs created inside them. 1,500-byte MTU, segmentation offloads off, so every packet has a real Ethernet size · every IP tunnel’s inner MTU 1,420 (WireGuard’s default), so all fit without fragmenting · links emulated in the router with tc netem: LAN (nothing added), 50 ms round trip (25 ms each way), 200 ms round trip with 1 % random loss in each direction
Tools
iperf3 3.18 for throughput · a small Go program for latency, bulk transfers and bring-up time · kernel defaults everywhere else (CUBIC, default socket buffers)
CPU
AMD Ryzen AI Max+ 395 · cores 0–7 and their SMT siblings reserved for the benchmark, everything else moved to the other CCD · server on cores 2–3, client on 4–5, router on 6–7
Method
Every tunnel started fresh for every run and link; every cell a fresh client process; 5 runs · reported value: median of the runs, with min–max · latency p99: each run’s 99th percentile, median across runs · a wait for a quiet link before every cell · throughput is what the iperf3 server received over its own test time (in 3 lossy-link cells over SSH the client could not collect those results through the stalled control connection; the server’s measurement is complete)
The scoreboard
Seven headline measures from the sections below, each tunnel's median as a multiple of the best tunnel's median for that measure (1×; log scale, a longer bar is worse), labelled with the measured value. Median of 5 runs; grey line: lowest to highest run. One cipher per tunnel (AES-256-GCM for OpenVPN and SSH; WireGuard is always ChaCha20-Poly1305); the ChaCha20 rows and the bare link are in the sections and in the table. CPU: the median of the per-run totals; the CPU figure's stacked bars add up the medians of their four parts, which can differ in the second decimal.Seven headline measures from the sections below, each tunnel's median as a multiple of the best tunnel's median for that measure (1×; log scale, a longer bar is worse), labelled with the measured value. Median of 5 runs; grey line: lowest to highest run. One cipher per tunnel (AES-256-GCM for OpenVPN and SSH; WireGuard is always ChaCha20-Poly1305); the ChaCha20 rows and the bare link are in the sections and in the table. CPU: the median of the per-run totals; the CPU figure's stacked bars add up the medians of their four parts, which can differ in the second decimal.
Measure
no tunnel
kernel WireGuard
wireguard-go
OpenVPN AES
SSH -L AES
SSH -w
Throughput, LAN, one TCP stream
21.1 Gbit/s 20.9–21.1 Gbit/s
4.2 Gbit/s 4.1–5.5 Gbit/s · 0.20×
8.5 Gbit/s 8.2–8.6 Gbit/s · 0.40×
2.7 Gbit/s 2.7 Gbit/s · 0.13×
14.8 Gbit/s 14.7–15.1 Gbit/s · 0.70×
2.5 Gbit/s 2.2–2.5 Gbit/s · 0.12×
Throughput, 50 ms link, one stream
619 Mbit/s 614–622 Mbit/s
512 Mbit/s 500–518 Mbit/s · 0.83×
550 Mbit/s 549–554 Mbit/s · 0.89×
47 Mbit/s 22–156 Mbit/s · 0.076×
317 Mbit/s 313–322 Mbit/s · 0.51×
201 Mbit/s 163–277 Mbit/s · 0.33×
Throughput, 200 ms + 1 % loss, one stream
1.4 Mbit/s 0.6–2.0 Mbit/s
0.8 Mbit/s 0.4–1.8 Mbit/s · 0.60×
1.3 Mbit/s 0.7–3.0 Mbit/s · 0.95×
1.0 Mbit/s 0.8–2.3 Mbit/s · 0.75×
0.7 Mbit/s 0.6–0.9 Mbit/s · 0.54×
0.7 Mbit/s 0.6–0.9 Mbit/s · 0.50×
Throughput, 200 ms + 1 % loss, four streams
4.8 Mbit/s 3.7–5.2 Mbit/s
4.7 Mbit/s 3.4–5.7 Mbit/s · 0.99×
7.2 Mbit/s 6.7–8.2 Mbit/s · 1.5×
3.9 Mbit/s 3.5–4.6 Mbit/s · 0.83×
0.8 Mbit/s 0.5–0.9 Mbit/s · 0.16×
0.6 Mbit/s 0.5–0.7 Mbit/s · 0.12×
LAN round trip, 100-byte message
5 µs 5 µs
40 µs 32–51 µs · 0.13×
30 µs 29–32 µs · 0.17×
16 µs 16–17 µs · 0.31×
23 µs 23–24 µs · 0.22×
21 µs 21 µs · 0.24×
Bytes per 100-byte message
152 B 152 B
221 B 221 B · 0.69×
221 B 221 B · 0.69×
205 B 205 B · 0.74×
201 B 201 B · 0.76×
250 B 250 B · 0.61×
CPU-seconds per gigabit
0.07 CPU-s 0.06–0.07 CPU-s
0.78 CPU-s 0.71–0.83 CPU-s · 0.088×
0.29 CPU-s 0.28–0.29 CPU-s · 0.24×
0.81 CPU-s 0.80–0.82 CPU-s · 0.085×
0.13 CPU-s 0.13 CPU-s · 0.52×
0.90 CPU-s 0.90–0.96 CPU-s · 0.076×
Median of 5 process runs, lowest to highest run beneath; bold: best apart from no tunnel in every run; after the range, the factor against no tunnel: above 1× better than no tunnel, below 1× worse, same: rounds to 1×.
Cost of each tunnel against no tunnel, lowest to highest measure: kernel WireGuard 1.0× on throughput, 200 ms + 1 % loss, four streams to 11× on CPU-seconds per gigabit; wireguard-go 0.66× on throughput, 200 ms + 1 % loss, four streams to 5.9× on LAN round trip, 100-byte message; OpenVPN AES 1.2× on throughput, 200 ms + 1 % loss, four streams to 13× on throughput, 50 ms link, one stream; SSH -L AES 1.3× on bytes per 100-byte message to 6.3× on throughput, 200 ms + 1 % loss, four streams; SSH -w 1.6× on bytes per 100-byte message to 13× on CPU-seconds per gigabit. Counting a measure only where every run agrees, wireguard-go is better than no tunnel on 1 (up to 1.5× on throughput, 200 ms + 1 % loss, four streams). The sections below take each measure in turn, with the ChaCha20 ciphers, UDP, the time to bring each tunnel up and the runs behind every median.
Each tunnel's median against the bare link's on the same measure, log scale; above 1× it would be better than no tunnel (more throughput, a shorter round trip, fewer bytes or less CPU). Median of 5 runs.Each tunnel's median against the bare link's on the same measure, log scale; above 1× it would be better than no tunnel (more throughput, a shorter round trip, fewer bytes or less CPU). Median of 5 runs.
Throughput on a LAN
The first question is the obvious one: how fast can each tunnel go when the network is not the limit?
iperf3 3.18, 5 seconds per cell, median of 5 runs (each a fresh iperf3 client and a freshly started tunnel); the grey line runs from the slowest to the fastest run. UDP: 1,200-byte datagrams sent as fast as the sender can, counted at the receiver. SSH port forwarding carries TCP only. Client, router and server each on two pinned cores.iperf3 3.18, 5 seconds per cell, median of 5 runs (each a fresh iperf3 client and a freshly started tunnel); the grey line runs from the slowest to the fastest run. UDP: 1,200-byte datagrams sent as fast as the sender can, counted at the receiver. SSH port forwarding carries TCP only. Client, router and server each on two pinned cores.
Throughput
LAN, 1 stream
LAN, 4 streams
LAN, UDP
50 ms, 1 stream
200 ms + 1 %, 1 stream
200 ms + 1 %, 4 streams
No tunnel
21.1 Gbit/s 20.9–21.1 Gbit/s
40.7 Gbit/s 40.5–41.0 Gbit/s
8.7 Gbit/s 8.4–8.8 Gbit/s
619 Mbit/s 614–622 Mbit/s
1.4 Mbit/s 0.6–2.0 Mbit/s
4.8 Mbit/s 3.7–5.2 Mbit/s
WireGuard, kernel
4.2 Gbit/s 4.1–5.5 Gbit/s
4.1 Gbit/s 4.0–5.4 Gbit/s
5.0 Gbit/s 4.8–6.5 Gbit/s
512 Mbit/s 500–518 Mbit/s
0.8 Mbit/s 0.4–1.8 Mbit/s
4.7 Mbit/s 3.4–5.7 Mbit/s
WireGuard, wireguard-go
8.5 Gbit/s 8.2–8.6 Gbit/s
6.8 Gbit/s 6.4–6.8 Gbit/s
2.1 Gbit/s 2.1–2.2 Gbit/s
550 Mbit/s 549–554 Mbit/s
1.3 Mbit/s 0.7–3.0 Mbit/s
7.2 Mbit/s 6.7–8.2 Mbit/s
OpenVPN, AES-256-GCM
2.7 Gbit/s 2.7–2.7 Gbit/s
3.6 Gbit/s 3.6–3.7 Gbit/s
4.0 Gbit/s 3.9–4.3 Gbit/s
47 Mbit/s 22–156 Mbit/s
1.0 Mbit/s 0.8–2.3 Mbit/s
3.9 Mbit/s 3.5–4.6 Mbit/s
OpenVPN, ChaCha20
2.4 Gbit/s 2.3–2.4 Gbit/s
3.0 Gbit/s 3.0–3.1 Gbit/s
3.3 Gbit/s 3.2–3.7 Gbit/s
29 Mbit/s 25–249 Mbit/s
0.9 Mbit/s 0.6–1.5 Mbit/s
3.9 Mbit/s 3.3–4.5 Mbit/s
SSH -L, AES-256-GCM
14.8 Gbit/s 14.7–15.1 Gbit/s
15.6 Gbit/s 15.0–15.9 Gbit/s
—
317 Mbit/s 313–322 Mbit/s
0.7 Mbit/s 0.6–0.9 Mbit/s
0.8 Mbit/s 0.5–0.9 Mbit/s
SSH -L, ChaCha20
8.4 Gbit/s 8.2–8.6 Gbit/s
8.4 Gbit/s 8.2–8.4 Gbit/s
—
313 Mbit/s 311–320 Mbit/s
0.8 Mbit/s 0.5–0.9 Mbit/s
0.6 Mbit/s 0.6–0.7 Mbit/s
SSH -w (TUN), AES-256-GCM
2.5 Gbit/s 2.2–2.5 Gbit/s
2.5 Gbit/s 2.4–2.5 Gbit/s
3.0 Gbit/s 2.7–3.0 Gbit/s
201 Mbit/s 163–277 Mbit/s
0.7 Mbit/s 0.6–0.9 Mbit/s
0.6 Mbit/s 0.5–0.7 Mbit/s
Without a tunnel one TCP stream moves 21.1 Gbit/s through the router. Through a tunnel (the numbers are measured; the reasons given under them are how each program is built, which this benchmark did not isolate):
SSH port forwarding is the fastest tunnel here, in every run: 14.8 Gbit/s with AES-256-GCM. Explanation: SSH forwards a byte stream, not packets. It reads up to 32 KB of the forwarded connection at a time and encrypts it as one SSH packet, and the outer TCP connection then cuts that into 1,500-byte segments. The per-packet cost of the IP tunnels, one encryption call, one authentication tag and one trip through the tunnel code per 1,420 bytes, mostly disappears. With ChaCha20-Poly1305 the same forward moves 8.4 Gbit/s: this CPU has AES in hardware, and ChaCha20 has to be computed in ordinary vector instructions.
wireguard-go beat the kernel module in every run: 8.5 Gbit/s against 4.2 Gbit/s (kernel WireGuard’s runs spread from 4.1 Gbit/s to 5.5 Gbit/s). Both encrypt with ChaCha20-Poly1305. Explanation, not measured here: recent wireguard-go no longer handles packets one at a time; it reads batches of segments from the TUN device with segmentation offload and sends them with UDP segmentation offload, so the per-packet trips between kernel and daemon are amortised. Kernel WireGuard hands every packet to worker threads spread over all 32 hardware threads, then puts them back in order. The CPU section shows where its work went; that the hand-off is what cost more than it parallelised is the likely reading, not a measurement.
OpenVPN manages 2.7 Gbit/s with AES-256-GCM and 2.4 Gbit/s with ChaCha20-Poly1305. Explanation: its data path is one userspace thread that reads each packet from the TUN device, encrypts it and writes it to a UDP socket: two system calls and two copies per packet in each direction, whichever cipher it uses.
The SSH layer-3 tunnel moves 2.5 Gbit/s, in the same range as OpenVPN (the three trade places from run to run). Explanation: it is SSH again, but now it carries packets read one at a time from a TUN device, so it pays OpenVPN’s per-packet costs on top of TCP.
Four streams change little inside a tunnel: OpenVPN gets 1.3–1.4× what one stream got, the other tunnels 0.8–1.1×: WireGuard (kernel) 4.1 Gbit/s, wireguard-go 6.8 Gbit/s, OpenVPN with AES-256-GCM 3.6 Gbit/s, OpenVPN with ChaCha20-Poly1305 3.0 Gbit/s, SSH port forwarding with AES-256-GCM 15.6 Gbit/s, SSH port forwarding with ChaCha20-Poly1305 8.4 Gbit/s, the SSH layer-3 tunnel 2.5 Gbit/s. Only the bare link scales, to 40.7 Gbit/s (1.9×). Explanation: each tunnel is one encrypting pipeline, already full with one stream.
UDP at full speed is a different test: iperf3 sends 1,200-byte datagrams as fast as it can and counts what arrives. A tunnel that cannot keep up has nowhere to put the excess, and the losses are reported as losses: the userspace tunnels lost 78–88 % of what was sent. Kernel WireGuard lost 0 % and delivered 5.0 Gbit/s: the sender was held back to what the tunnel could carry instead of having its datagrams dropped. SSH’s layer-3 tunnel survived the flood in all 5 measured runs. In development runs on cores shared with other work it did not: sshd closed the session within seconds with “channel 0: peer ignored channel window”, because the client kept writing TUN packets into the channel past the window the server had granted. Under a UDP flood, ssh -w depends on timing.
CPU per gigabit
Throughput on a LAN is really a CPU measurement, so measure the CPU directly: every busy core-second on the client, the router and the server, plus kernel worker threads anywhere else, divided by the gigabits delivered.
Busy time of the client's, the router's and the server's two pinned cores each (from /proc/stat, so interrupts and kernel work count), plus kernel worker threads on every other core, divided by the gigabits delivered in the one-stream LAN cell. The split between the pinned groups is only approximate: a virtual Ethernet pair delivers a packet on the core that sent it, so some of the router's and the server's work lands on the sender's cores. The totals are not affected. Median of 5 runs; the grey line runs from the cheapest to the dearest run's total. 1.0 = one core fully busy for every 1 Gbit/s.Busy time of the client's, the router's and the server's two pinned cores each (from /proc/stat, so interrupts and kernel work count), plus kernel worker threads on every other core, divided by the gigabits delivered in the one-stream LAN cell. The split between the pinned groups is only approximate: a virtual Ethernet pair delivers a packet on the core that sent it, so some of the router's and the server's work lands on the sender's cores. The totals are not affected. Median of 5 runs; the grey line runs from the cheapest to the dearest run's total. 1.0 = one core fully busy for every 1 Gbit/s.
Moving a gigabit without a tunnel costs 0.07 CPU-seconds: copying data in and out of sockets and pushing packets through two virtual links. Each tunnel adds encryption, authentication, and, for the userspace ones, trips between the kernel and a daemon. The totals are solid; the split between client, router and server cores is approximate, because a virtual Ethernet pair delivers a packet on the core that sent it. Three results stand out (the reasons are explanations from how the programs are built, not something measured here):
Kernel WireGuard does 76 % of its work off the pinned cores. By design it hands every packet to a per-CPU worker queue and distributes them over all cores in the machine, then puts them back in order. On a busy server that is free parallelism; on a machine where you wanted the tunnel confined to a few cores, it is not, and no CPU set or cgroup can confine it.
Packet-at-a-time userspace tunnels cost the most, together with kernel WireGuard: OpenVPN 0.81 CPU-seconds with AES-256-GCM and 0.94 with ChaCha20, the SSH layer-3 tunnel 0.91, kernel WireGuard 0.76; these four overlap from run to run and have no fixed order. Explanation for the userspace three: each packet crosses the kernel boundary four times (TUN read, socket write; socket read, TUN write) in addition to being encrypted.
The cheap userspace tunnels are the ones that batch: wireguard-go 0.29, SSH port forwarding 0.13 with AES-256-GCM, the cheapest tunnel in every run. Both move data in large pieces (explanation), and both cost less per gigabit than the kernel’s own WireGuard (0.76) in every run.
Bytes per packet
What does each tunnel add to every packet? A 100-byte message on an open TCP connection, counted on the client’s interface; the difference per packet is what the tunnel adds:
Interface counters on the underlay before and after the LAN latency cell (500 requests and 500 responses of 100 bytes), divided by the 1,000 messages; IP header and everything above it, Ethernet header excluded. Median of 5 runs. After the bar: what the tunnel adds per packet (bytes per packet minus the same without a tunnel).Interface counters on the underlay before and after the LAN latency cell (500 requests and 500 responses of 100 bytes), divided by the 1,000 messages; IP header and everything above it, Ethernet header excluded. Median of 5 runs. After the bar: what the tunnel adds per packet (bytes per packet minus the same without a tunnel).
Without a tunnel the message is 152 bytes on the wire: 100 bytes of data, 20 of IPv4 and 32 of TCP with timestamps. What each tunnel adds:
WireGuard: 68 B. A new IPv4 header (20) and UDP header (8), WireGuard’s 16-byte header (type, receiver index, 8-byte counter), the 16-byte Poly1305 tag, and padding of the encrypted packet to a multiple of 16 bytes, here 8.
OpenVPN: 52 B, either cipher. IPv4 and UDP (28), a 4-byte opcode and peer ID, a 4-byte packet ID and the 16-byte tag. No padding.
SSH port forwarding: 48 B with AES-256-GCM, 40 B with ChaCha20. The inner IP and TCP headers never travel: SSH carries the bytes, and the outer TCP connection carries SSH. What is added is SSH’s packet length, padding length, a 9-byte channel-data header, padding to the cipher’s block size and the 16-byte tag.
The SSH layer-3 tunnel: 95 B. Both: the whole inner IP packet, wrapped in SSH, inside an outer TCP connection with its own 52 bytes of headers.
For a full 1,420-byte packet these are 3–7 % of the bytes on the wire. For the small packets of a voice call or a game they can be half.
Latency added
One 100-byte request and its response, over and over, on an open connection:
One 100-byte request, one 100-byte response, the next request after the response; TCP_NODELAY on; 500 round trips per run on the LAN, 100 at 50 ms, 50 on the lossy link; median of 5 runs, the grey line from the lowest to the highest run's median. p99: each run's 99th percentile, median across runs. Each link has its own scale.One 100-byte request, one 100-byte response, the next request after the response; TCP_NODELAY on; 500 round trips per run on the LAN, 100 at 50 ms, 50 on the lossy link; median of 5 runs, the grey line from the lowest to the highest run's median. p99: each run's 99th percentile, median across runs. Each link has its own scale.
On the LAN a round trip without a tunnel takes 5 µs. The tunnels add between 11 µs and 35 µs, OpenVPN the least and kernel WireGuard the most in every run. A likely explanation, not measured: the userspace tunnels pay for waking a daemon at each end, kernel WireGuard for its hand-off to a worker queue and the reordering after it. On the 50 ms link those microseconds disappear inside the network’s own delay. On the lossy link the medians stay near 200 ms for everyone. The 99th percentile is where a lost packet shows, as a retransmission that takes at least another round trip: 201 ms to 619 ms across the rows. With 50 round trips per run, whether a run’s slowest one includes a lost packet is mostly luck, so these tails say little about the tunnels.
Bringing a tunnel up
How long from starting the tunnel until the first byte gets through it? The clock starts when the client side is launched (the server side is already listening) and stops when a TCP connection through the tunnel echoes its first bytes. That probe needs two round trips itself, a TCP handshake and the echo, which is all the no-tunnel row measures.
The clock starts in the client container just before the client side is started (interface configured, daemon launched, ssh run); it stops when a TCP connection through the tunnel echoes 29 bytes back intact. Probes start every 5 ms. The server side was already listening. Median of 5 runs; the grey line runs from the fastest to the slowest run. Each link has its own scale.The clock starts in the client container just before the client side is started (interface configured, daemon launched, ssh run); it stops when a TCP connection through the tunnel echoes 29 bytes back intact. Probes start every 5 ms. The server side was already listening. Median of 5 runs; the grey line runs from the fastest to the slowest run. Each link has its own scale.
WireGuard costs one round trip more than no tunnel: one handshake message each way, then data. There is no negotiation: both ends already have each other’s public keys.
SSH took 554 ms longer than no tunnel on the 50 ms link, the time of about 11 round trips: TCP, version exchange, key exchange, authentication, opening the channel or the TUN device.
OpenVPN took 436 ms with AES-256-GCM and 722 ms with ChaCha20 on the LAN, where the others took milliseconds, and varied from run to run between 40.1 ms and 982 ms. Its TLS handshake runs over its own reliability layer on UDP, driven by timers that count in whole seconds: on a LAN, the waiting, not the network, is most of the time.
On the 200 ms link the order between the two slow ones turned: OpenVPN was up in 1,391–1,667 ms, SSH in 2,314–2,904 ms, OpenVPN first in 4 of 5 runs. Explanation: once each round trip costs 200 ms, SSH’s longer exchange outweighs OpenVPN’s timers. A lost handshake packet has to time out before it is resent, and the slowest runs show it: OpenVPN’s slowest bring-up took 7,346 ms, SSH’s 3,187 ms, WireGuard’s 618 ms.
Slow and lossy links: TCP inside TCP
The textbook warning about SSH tunnels and other TCP-based VPNs is TCP meltdown: when a packet is lost, the outer TCP connection retransmits it and holds everything behind it, while the inner TCP connections see a sudden delay, time out and retransmit too, piling more data into a connection that is already recovering. UDP tunnels don’t have this problem: a lost outer packet is a lost inner packet, and only the inner TCP reacts.
iperf3, 10 s on the 50 ms link and 15 s on the lossy one, median of 5 runs; the grey line runs from the slowest to the fastest run. Throughput is what the server received over its own test time, which includes draining what the tunnel had buffered. Loss is applied to the underlay packets, so a tunnel over UDP loses outer packets and the inner TCP sees each loss once; a tunnel over TCP (SSH) retransmits underneath and the inner TCP sees a stall instead.iperf3, 10 s on the 50 ms link and 15 s on the lossy one, median of 5 runs; the grey line runs from the slowest to the fastest run. Throughput is what the server received over its own test time, which includes draining what the tunnel had buffered. Loss is applied to the underlay packets, so a tunnel over UDP loses outer packets and the inner TCP sees each loss once; a tunnel over TCP (SSH) retransmits underneath and the inner TCP sees a stall instead.
On the 50 ms link without loss, one stream without a tunnel reaches 619 Mbit/s, set by the default socket buffers, not the link. OpenVPN falls to 47 Mbit/s (22–249 Mbit/s across runs and ciphers, the slowest row in every run), and not because of the link: the inner TCP sends in bursts, the bursts arrive faster than one OpenVPN thread can decrypt them, and OpenVPN’s UDP socket, at its default 212,992-byte buffer, overflows. The kernel counted 540 datagrams dropped that way per run, against 0 for wireguard-go, which asks for larger buffers itself. Each drop is a lost packet to the inner TCP, which shrinks its window every time. OpenVPN’s --rcvbuf and --sndbuf options exist for this; they were left at their defaults here, as everything else was. On the 200 ms link with 1 % loss, single-stream throughput collapses for everyone: without a tunnel 1.4 Mbit/s, inside the UDP tunnels 0.8–1.3 Mbit/s, inside SSH 0.7–0.8 Mbit/s. SSH’s medians are the lowest, but runs of the same tunnel spread wider than the gaps between tunnels (see the table above): on one stream there is no clear meltdown. One TCP connection with 1 % loss on a 200 ms round trip cannot do much better whatever carries it: the Mathis estimate, 1.22 × segment size ÷ (round trip × √loss), gives 0.7 Mbit/s for 1,448-byte segments. Four streams are where the two kinds of tunnel separate:
4 streams, 200 ms + 1 %
Throughput
vs one stream
no tunnel
4.8 Mbit/s
3.5×
WireGuard (kernel)
4.7 Mbit/s
5.7×
wireguard-go
7.2 Mbit/s
5.5×
OpenVPN with AES-256-GCM
3.9 Mbit/s
3.8×
OpenVPN with ChaCha20-Poly1305
3.9 Mbit/s
4.3×
SSH port forwarding with AES-256-GCM
0.8 Mbit/s
1.0×
SSH port forwarding with ChaCha20-Poly1305
0.6 Mbit/s
0.7×
the SSH layer-3 tunnel
0.6 Mbit/s
0.8×
Four TCP connections inside a UDP tunnel are four independent connections: each loses its own packets and recovers on its own, and together they got 3.5–5.7× as much as one. Four connections inside one SSH connection are not: they share the outer TCP connection, which still loses 1 % of its packets and still recovers from each loss alone, so the four inner streams only divide the same 0.8 Mbit/s among themselves.
What this does not show
Real NICs. Virtual Ethernet between containers on one host has no wire and no NIC offloads (they were turned off so packets keep real sizes). A real 10 or 25 Gbit/s card with segmentation offload and multiple receive queues changes every absolute number, and kernel WireGuard and OpenVPN’s kernel offload (DCO) are built to profit from them.
OpenVPN DCO. The data-channel-offload kernel module moves OpenVPN’s encryption into the kernel like WireGuard’s. It was not loaded on this host, so every OpenVPN number here is the classic userspace data path.
CPU attribution. A virtual Ethernet pair delivers a packet on the core that sent it, so the split between client, router and server cores is approximate; the totals are not. The reasons given for the CPU and throughput differences (batching, per-packet system calls, the kernel’s worker hand-off) are explanations from how the programs are built; this benchmark did not isolate them. Kernel WireGuard’s workers ran on cores shared with other work, measured from their own thread times.
Real loss.netem drops packets independently at random. Real links lose in bursts and change their round trip, which is worse for every tunnel and worst for TCP inside TCP.
Many peers. One client, one server. A VPN concentrator with thousands of peers is a different benchmark: handshake rates, key rotation and per-peer state matter there.
IPsec. strongSwan with the kernel’s ESP was not measured: its module was not loaded on this host and the benchmark did not load kernel modules.
What the numbers say
On a fast link a tunnel is a CPU cost, and what separates the tunnels tracks how many times the data crosses into and out of the tunnel, not the cipher (the explanation that fits; the benchmark measured the cost, not the cause). SSH port forwarding (14.8 Gbit/s) and wireguard-go (8.5 Gbit/s) move data in large batches; OpenVPN (2.7 Gbit/s) and ssh -w (2.5 Gbit/s) handle one packet at a time.
AES-256-GCM beat ChaCha20-Poly1305 on this CPU, which has AES in hardware: 14.8 Gbit/s against 8.4 Gbit/s for SSH, 2.7 Gbit/s against 2.4 Gbit/s for OpenVPN. The gap is smaller where per-packet overhead, not the cipher, is the limit.
WireGuard costs 68 bytes per packet and one round trip to come up. The kernel module did 76 % of its work on cores outside the pinned ones and was the only tunnel that carried the UDP flood without loss.
Latency added on a LAN is tens of microseconds for every tunnel; on a WAN it is lost in the noise.
Don’t run several TCP connections through one SSH connection on a lossy link: they share its losses. A UDP tunnel lets them recover independently.
OpenVPN at its default socket buffers loses packets on a 50 ms link before the link is anywhere near full: 47 Mbit/s where no tunnel got 619 Mbit/s.
Reproduce it
The harness is three shell scripts, a Go program for latency, bulk transfer and bring-up time, and a Dockerfile. It needs Docker and, for the kernel WireGuard row, the wireguard module already loaded on the host.
docker build -t tunb . && ./keys.sh # image, throwaway keys and certificates./up.sh 4-5 2-3 6-7 # client, server, router coresdocker exec tn-r tc qdisc replace dev ra root netem delay 25ms limit 100000 # the 50 ms link,docker exec tn-r tc qdisc replace dev rb root netem delay 25ms limit 100000 # both directionsdocker exec tn-b sh /h/t.sh srv wg && docker exec tn-a sh /h/t.sh cli wg # prints {"connect_ms": ...}docker exec tn-a iperf3 -c 198.51.100.2 -t 10docker exec tn-a tb rr -addr 198.51.100.2:7000 -n 100 -size 100
run.sh runs the whole matrix and writes one JSON line per cell: throughput, every latency sample, the interface counters and the transfer checks.