Files
tailscale/kernel/linux/scripts/leancompare.sh
T
Brad Fitzpatrick 06bdac96d3 kernel/linux/{DESIGN.md,scripts}: record the performance work, add leancompare.sh
DESIGN.md's Performance section now describes what tswg changes in the
data path and why, the results against wireguard-go (parity to 1.05x on
bulk TCP at 6-10% less CPU per byte, much better small-packet delivery,
worse idle and p99-under-load latency in VMs) and the tools for this
work. The TODO list gets the open performance items.

leancompare.sh runs the lean harness's interleaved A/B comparison for
RTT and TCP with 1 and 4 streams.

Updates #426

Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: Icf8c7ca8bb3711a8172284382af9ce8c3e25ff3d
2026-11-07 14:38:57 +00:00

39 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# leancompare.sh runs tailscale.com's TestLeanCompare (see leanbench.sh) for
# tswg and wireguard-go three ways: UDP round trips (idle and under a TCP
# load), and TCP throughput with 1 and 4 streams, and prints the medians.
# It's for quick A/B checks of a change; logs go to $TSWG_COMPARE_LOGS
# (default /tmp/leancompare).
#
# Environment:
# TSWG_COMPARE_MODES data planes to compare (default tswg,wggo)
# TSWG_COMPARE_RUNS runs of each (default 4)
# TAILSCALE_DIR the tailscale.com checkout (default ~/src/tailscale.com-tswg)
#
# usage: leancompare.sh [go test flags...]
set -eu
top=$(cd "$(dirname "$0")/.." && pwd)
ts=${TAILSCALE_DIR:-$HOME/src/tailscale.com-tswg}
logs=${TSWG_COMPARE_LOGS:-/tmp/leancompare}
mkdir -p "$logs"
export TSWG_LEAN=1 TSWG_DIR="$top"
export TSWG_LEAN_COMPARE="${TSWG_COMPARE_MODES:-tswg,wggo}"
export TSWG_COMPARE_RUNS="${TSWG_COMPARE_RUNS:-4}"
cd "$ts"
for load in rtt tcp1 tcp4; do
case $load in
rtt) TSWG_COMPARE_LOAD=rtt TSWG_COMPARE_STREAMS=1 ;;
tcp1) TSWG_COMPARE_LOAD=tcp TSWG_COMPARE_STREAMS=1 ;;
tcp4) TSWG_COMPARE_LOAD=tcp TSWG_COMPARE_STREAMS=4 ;;
esac
export TSWG_COMPARE_LOAD TSWG_COMPARE_STREAMS
echo "== $load" >&2
go test -count=1 ./tstest/tswgbench/ -run 'TestLeanCompare$' -v -timeout=30m "$@" \
> "$logs/$load.log" 2>&1 || true
grep -E -e '--- FAIL|median|kernel reported' "$logs/$load.log" | sed 's/^ *compare_test.go:[0-9]*: //'
done