mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-20 16:51:18 -08:00
kernel/linux/{scripts,DESIGN.md}: add the subnet router benchmark and its results
subnetbench.sh runs tailscale.com's TestLeanSubnetRouter on the EC2 instances for each router CPU count given. ec2.sh now turns off source and destination checks on its instances, so that one can forward as a subnet router does, and installs nftables (for the router's masquerade). DESIGN.md records the results: with 4 clients, tswg as the subnet router forwards 2.1x (4 CPUs) to 3.2x (8 CPUs) what wireguard-go does, which uses about 3 CPUs however many it has, at the least CPU per byte of any tunnel, and reaches the 25 Gbps link at 16 CPUs. Zero-copy receive was tried there and was 7% worse, so isn't in. Updates #426 Signed-off-by: Brad Fitzpatrick <[email protected]> Change-Id: I6b1da8bb8eaa17f9b20cbe36896426411b8b905f
This commit is contained in:
1 parent
f889883537
commit
df191a1199
3 files changed
+97
-7
No files matched your search
@@ -143,7 +143,7 @@ userdata() {
|
||||
set -e
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update -q
|
||||
apt-get install -qy build-essential gcc-13 gcc-14 "linux-headers-$(uname -r)"
|
||||
apt-get install -qy build-essential gcc-13 gcc-14 nftables "linux-headers-$(uname -r)"
|
||||
touch /var/lib/tswg-ready
|
||||
EOF
|
||||
}
|
||||
@@ -201,6 +201,9 @@ up)
|
||||
--tag-specifications "$(tags "$name-$i" instance)" "$(tags "$name-$i" volume)" \
|
||||
--query 'Instances[0].InstanceId' --output text)
|
||||
echo "launched $name-$i ($type): $id" >&2
|
||||
# Let it forward packets that aren't its own, as a subnet router does.
|
||||
ec2 wait instance-exists --instance-ids "$id"
|
||||
ec2 modify-instance-attribute --instance-id "$id" --no-source-dest-check
|
||||
ids="$ids $id"
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
#
|
||||
# subnetbench.sh runs tailscale.com's TestLeanSubnetRouter (a subnet router
|
||||
# with many clients and flows; see tstest/tswgbench/subnet_test.go) on the
|
||||
# EC2 instances from ec2.sh, once for each router CPU count given, and
|
||||
# prints the medians. Logs go to $TSWG_SUBNET_LOGS (default /tmp/subnetbench).
|
||||
#
|
||||
# Environment (see subnet_test.go for more):
|
||||
# TSWG_LEAN_SUBNET router data planes (default plain,tswg,wggo,kernelwg)
|
||||
# TSWG_COMPARE_RUNS runs of each (default 3)
|
||||
# TAILSCALE_DIR the tailscale.com checkout (default ~/src/tailscale.com-tswg)
|
||||
#
|
||||
# usage: subnetbench.sh [ROUTER_CPUS...] (default: all of the router's CPUs)
|
||||
|
||||
set -eu
|
||||
|
||||
top=$(cd "$(dirname "$0")/.." && pwd)
|
||||
ts=${TAILSCALE_DIR:-$HOME/src/tailscale.com-tswg}
|
||||
logs=${TSWG_SUBNET_LOGS:-/tmp/subnetbench}
|
||||
mkdir -p "$logs"
|
||||
export TSWG_LEAN=1 TSWG_DIR="$top"
|
||||
export TSWG_REMOTE="${TSWG_REMOTE:-$HOME/.cache/tslinux/ec2/hosts.json}"
|
||||
export TSWG_LEAN_SUBNET="${TSWG_LEAN_SUBNET:-plain,tswg,wggo,kernelwg}"
|
||||
export TSWG_COMPARE_RUNS="${TSWG_COMPARE_RUNS:-3}"
|
||||
cd "$ts"
|
||||
[ $# -gt 0 ] || set -- 0
|
||||
for cpus in "$@"; do
|
||||
echo "== router CPUs: $cpus (0 is all)" >&2
|
||||
TSWG_SUBNET_ROUTER_CPUS=$cpus go test -count=1 ./tstest/tswgbench/ \
|
||||
-run 'TestLeanSubnetRouter$' -v -timeout=60m > "$logs/cpus$cpus.log" 2>&1 || true
|
||||
grep -E -e '--- FAIL|router .* CPUs|median|kernel reported' "$logs/cpus$cpus.log" |
|
||||
sed 's/^ *[a-z_]*_test.go:[0-9]*: //'
|
||||
done
|
||||
Reference in new issue
Block a user