Files
benchmarks/framework/zip/distributed.sh
zeekay c61d5891e3 bench(framework/zip): distributed amd64-host→arm64-host + real ceiling analysis
bombardier (not hey) shows loopback fasthttp 365k / zip 348k = 0.95x parity.
Distributed amd64-host(32c)→arm64-host over eno1 1GbE: 194k, and WORSE at higher conns
(c4000 167k/24ms, c8000 154k/52ms) = link saturation, not CPU. arm64-host's 20 cores
idle at 194k → box not maxed, the 1GbE link is. Path to 1M+: 10GbE/RDMA or the
native ZAP binary transport. Adds distributed.sh.
2026-07-16 20:15:17 -07:00

35 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Distributed load: server on THIS box, load driven from a separate host over the
# network — so the server doesn't fight the load generator for cores. Reveals
# whether you're CPU-bound (server) or I/O-bound (the link).
#
# LOADER=<ssh host> TARGET=<this box, as the loader resolves it> ./distributed.sh
# LOADER=<ssh host> TARGET=<host> CONN=1000 DUR=8s ./distributed.sh
#
# Finding on a 1GbE-class link between a 20-core server and a 32-core loader:
# ~194k req/sec at c=1000, and it gets WORSE with more conns (c4000→167k/24ms,
# c8000→154k/52ms) — classic congestion collapse. The link's packet rate is the
# ceiling, not the server's cores (which sit mostly idle at 194k). Loopback hits
# 365k only because it shares cores with the loader; the true serving ceiling is
# higher than both and needs a faster link (10GbE/RDMA) or the tighter ZAP binary
# transport to expose.
set -euo pipefail
cd "$(dirname "$0")"
LOADER=${LOADER:?set LOADER to the ssh host that drives the load}; TARGET=${TARGET:?set TARGET to this host as the loader resolves it}
CONN=${CONN:-1000}; DUR=${DUR:-8s}
FH=${FH:-8392}; ZP=${ZP:-8391}
export GOFLAGS=-mod=mod GOPRIVATE="github.com/hanzoai,github.com/luxfi,github.com/zap-proto"
BIN=$(mktemp); trap 'rm -f "$BIN"; kill ${PIDS:-} 2>/dev/null || true' EXIT
go build -o "$BIN" .
"$BIN" -fw fasthttp -addr ":$FH" >/tmp/zb-fh.log 2>&1 & PIDS+=" $!"
"$BIN" -fw zip -addr ":$ZP" >/tmp/zb-zip.log 2>&1 & PIDS+=" $!"
command curl -s --retry 20 --retry-connrefused --retry-delay 1 -m2 -o /dev/null "http://127.0.0.1:$FH/health"
ssh "$LOADER" bash -s <<EOF 2>&1 | grep -iE 'target ip|conn=|Reqs/sec|Latency|2xx|== '
export PATH=\$HOME/go/bin:\$PATH
command -v bombardier >/dev/null || GOFLAGS= GOBIN=\$HOME/go/bin go install github.com/codesenberg/bombardier@latest >/dev/null 2>&1
SIP=\$(getent hosts $TARGET | awk '{print \$1}' | head -1); echo "target ip=\$SIP"
curl -s -m3 -o /dev/null -w "conn=%{http_code}\n" http://\$SIP:$FH/health
echo "== fasthttp (c$CONN) =="; bombardier -c $CONN -d $DUR http://\$SIP:$FH/health 2>&1 | grep -iE 'Reqs/sec|Latency|2xx'
echo "== zip http (c$CONN) =="; bombardier -c $CONN -d $DUR http://\$SIP:$ZP/health 2>&1 | grep -iE 'Reqs/sec|Latency|2xx'
EOF