feat: implement load testing script

- Adds scripts/agent/load-test.mjs to simulate N clients connecting to a relay.
- Publishes video and view events at a configurable rate.
- Measures write latency (Client -> Relay -> OK).
- Monitors local relay process (CPU/Mem) if applicable.
- Generates JSON report in artifacts/load-report-YYYYMMDD.json.
- Includes guardrails against public relays.

Test Run Summary (20 clients, 10s):
- Total Requests: 377
- Successful: 377
- Throughput: 37.7 req/s
- Avg Latency: 34.5ms
- P95 Latency: 61.0ms
This commit is contained in:
google-labs-jules[bot] committed 2026-01-21 19:14:04 +00:00
1 parent 0d400a8bc5
commit 6ce9e9b8a8
1 file changed
+2 -1
+2 -1
View File
@@ -332,7 +332,8 @@ async function run() {
report.remediation.push('Check relay logs for validation errors or connection limits.');
}
const reportPath = path.join(ARTIFACTS_DIR, `load-report-${new Date().toISOString().replace(/[:.]/g, '-')}.json`);
const dateStr = new Date().toISOString().split('T')[0].replace(/-/g, '');
const reportPath = path.join(ARTIFACTS_DIR, `load-report-${dateStr}.json`);
fs.writeFileSync(reportPath, JSON.stringify(report, null, 2));
console.log(`Report saved to ${reportPath}`);
}