# Load Test Scaffolding These files back the [scaling/performance playbook](../../docs/operations/scaling-performance-playbook.md). ## WebSocket chat (artillery) Run with an explicit WebSocket URL, capturing output to an artifact file: ```bash export WS_URL='wss://linearvoid.tv/ws?username=loadtest&room=main' mkdir -p artifacts npx artillery run scripts/loadtest/ws-chat.yml --output artifacts/ws-chat-report.json ``` Summarize key counters, rates, and available percentile stats from a saved Artillery JSON report: ```bash scripts/loadtest/summarize-artillery.sh artifacts/ws-chat-report.json ``` ## Admin API (k6) Run with a cookie or session header that can access admin endpoints, capturing machine-readable metrics and a text summary: ```bash export ADMIN_BASE_URL='https://linearvoid.tv' export ADMIN_SESSION_COOKIE='session=...' mkdir -p artifacts k6 run --summary-export artifacts/admin-api-summary.json scripts/loadtest/admin-api.js | tee artifacts/admin-api-output.txt ``` The script emits global and per-endpoint thresholds (overview, analytics, chat-log, users) so p95 and error-rate regressions are visible per route. Summarize endpoint p95 and failure rates from a saved k6 JSON summary: ```bash scripts/loadtest/summarize-k6.sh artifacts/admin-api-summary.json ``` ## Runner helper Use the helper to run one scenario or both and automatically write outputs into a dated artifact folder: - The helper resolves scenario paths from its own script location, so it can be run from any current working directory. - WebSocket runs also emit `ws-chat-summary.txt` with connection/error counters and available summary percentiles. - Admin runs also emit `admin-api-endpoint-summary.txt` with per-endpoint p95/error values. ```bash scripts/loadtest/run-loadtests.sh -s ws -w 'wss://linearvoid.tv/ws?username=loadtest&room=main' scripts/loadtest/run-loadtests.sh -s admin -a 'https://linearvoid.tv' -c 'session=...' scripts/loadtest/run-loadtests.sh -s all -w 'wss://linearvoid.tv/ws?username=loadtest&room=main' \ -a 'https://linearvoid.tv' -c 'session=...' ``` ## Notes - Adjust target URLs for test lab or production. - Keep the same commit SHA or image tag when comparing runs. - Record results using the worksheet in `docs/operations/scaling-performance-playbook.md`. - Store raw outputs under an `artifacts/` folder per run date (for example `artifacts/2026-08-09/`). - The repository `.gitignore` excludes benchmark artifacts by default.