Files
coturn/examples/loadtest/allocation_flood.sh
Pavel Punsky 69bc0e7351 Load generator mode in turnutils_uclient (#1894)
## Summary

Adds load-generator modes to `turnutils_uclient` for repeatable TURN
server performance testing:

- Adds `-Y packet|alloc|invalid` load modes.
- Supports packet flood, allocation flood, and invalid-packet flood
workflows.
- Adds unique local client ports for allocation flood mode.
- Removes default packet pacing in load-generator modes unless
explicitly set.
- Adds helper scripts under `examples/loadtest/`.
- Documents load-test usage in `README.turnutils`,
`man/man1/turnutils.1`, `CLAUDE.md`, and
`docs/PerformanceIterationLog.md`.

The performance log captures DigitalOcean benchmark methodology, A/B
lessons, hot-path findings, and future optimization candidates.
2026-05-03 22:03:08 -07:00

46 lines
1005 B
Bash
Executable File

#!/bin/bash
set -eu
# Allocation flood does not start turnutils_peer.
# turnutils_uclient now generates a unique synthetic peer ip:port for
# each new allocation cycle, so only turnserver and uclient are needed.
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
REPO_ROOT="$(CDPATH= cd -- "${SCRIPT_DIR}/../.." && pwd)"
BINDIR="${REPO_ROOT}/build/bin"
if [ ! -x "${BINDIR}/turnserver" ]; then
BINDIR="${REPO_ROOT}/bin"
fi
cleanup() {
kill "${uclient_pid:-}" "${turnserver_pid:-}" 2>/dev/null || true
wait "${uclient_pid:-}" "${turnserver_pid:-}" 2>/dev/null || true
}
trap cleanup EXIT INT TERM
"${BINDIR}/turnserver" \
--use-auth-secret \
--static-auth-secret=secret \
--realm=north.gov \
--allow-loopback-peers \
--listening-ip=127.0.0.1 \
--relay-ip=127.0.0.1 \
> /dev/null 2>&1 &
turnserver_pid=$!
sleep 2
"${BINDIR}/turnutils_uclient" \
-Y alloc \
-m 50 \
-L 127.0.0.1 \
-u user \
-W secret \
"$@" \
127.0.0.1 &
uclient_pid=$!
wait "${uclient_pid}"