Files
tailscale/kernel/linux/scripts/bench.sh
T
Brad Fitzpatrick ac26c5bfce kernel/linux/{scripts,DESIGN.md}: add bench.sh and record first natlab benchmarks
bench.sh runs tailscale.com's TestTSWGBenchmark, which compares
tailscaled in kernel mode against tailscaled in TUN mode (wireguard-go)
on the same pair of natlab gokrazy VMs, and saves the results as JSON.

Record the first results: bulk TCP throughput and CPU per byte are about
the same (natlab caps throughput, and the kernel lacks outer UDP
GSO/GRO), while the kernel receives about 1.7x the small packets per
second at about 30% less CPU per packet and roughly halves latency under
load. Also record the plan for a lean benchmark harness without natlab,
whose userspace switch is expensive, and a flake seen when both peers
restart at once.

Updates #426

Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: I69e696817f98e685576a30d766c42740d4d04810
2026-11-07 05:52:04 +00:00

23 lines
767 B
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# bench.sh runs TestTSWGBenchmark, which compares the tswg kernel data
# plane against wireguard-go on a pair of natlab gokrazy VMs, and writes
# the results as JSON to out/bench-<time>.json (or $TSWG_BENCH_OUT).
#
# Environment:
# TSWG_BENCH_CPUS virtual CPUs per VM (default 2)
# TSWG_BENCH_DUR length of each throughput run (default 10s)
# TSWG_BENCH_OUT where to write the JSON results
#
# usage: bench.sh [go test flags...]
set -eu
top=$(cd "$(dirname "$0")/.." && pwd)
mkdir -p "$top/out"
export TSWG_BENCH=1
export TSWG_BENCH_OUT="${TSWG_BENCH_OUT:-$top/out/bench-$(date -u +%Y%m%dT%H%M%SZ).json}"
echo "writing results to $TSWG_BENCH_OUT" >&2
exec "$top/scripts/vmtest.sh" 'TestTSWGBenchmark$' "$@"