test(sfu): add multi-room scale test - #80
Conversation
Puppeteer test that creates M concurrent rooms (broadcaster + V viewers each) to exercise mediasoup worker placement and dynamic worker scaling across rooms — you test many viewers in one room, this tests many rooms x workers. - load-test/multi-room-scale.js — per-room broadcaster+viewers; progressive CSV; multi-account support - load-test/results/MULTI-ROOM-SCALE.md — worker-placement/WORKER_THRESHOLD sampling, caveats Authored by Claude (Anthropic) via Claude Code. Not executed against a live backend — results are placeholders, not fabricated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There was a problem hiding this comment.
5 issues found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="load-test/multi-room-scale.js">
<violation number="1" location="load-test/multi-room-scale.js:186">
P1: Every login times out because the frontend never exposes `window.__csSocket`; expose test-ready markers or wait on existing UI/socket conditions before using the later markers.</violation>
<violation number="2" location="load-test/multi-room-scale.js:199">
P2: With `--emails` using multiple accounts, all pages share one cookie jar; a reconnect can authenticate an existing room as the most recently logged-in account. Create an isolated browser context per room/account.</violation>
<violation number="3" location="load-test/multi-room-scale.js:319">
P2: Viewer latency includes navigation and form rendering because `startTime` precedes `page.goto()`; move the timestamp immediately before `form.requestSubmit()`.</violation>
<violation number="4" location="load-test/multi-room-scale.js:456">
P2: When room creation succeeds but broadcaster setup fails, this condition still launches viewers; gate the viewer batch on `broadcaster.ok` instead of `broadcaster.roomId`.</violation>
</file>
<file name="load-test/results/MULTI-ROOM-SCALE.md">
<violation number="1" location="load-test/results/MULTI-ROOM-SCALE.md:11">
P3: `load-test/sfu-capacity.js` does not exist in the repo, so the "existing" reference (and the roadmap-gap claim that it currently covers single-room capacity) is inaccurate and will send readers on a dead-end. Update the reference to the actual load-test script, or clarify that this script is new and there is currently no single-room capacity test.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
|
||
| await page.waitForFunction( | ||
| () => | ||
| window.__csSocket && |
There was a problem hiding this comment.
P1: Every login times out because the frontend never exposes window.__csSocket; expose test-ready markers or wait on existing UI/socket conditions before using the later markers.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At load-test/multi-room-scale.js, line 186:
<comment>Every login times out because the frontend never exposes `window.__csSocket`; expose test-ready markers or wait on existing UI/socket conditions before using the later markers.</comment>
<file context>
@@ -0,0 +1,604 @@
+
+ await page.waitForFunction(
+ () =>
+ window.__csSocket &&
+ window.__csSocket.connected === true,
+ { timeout: WAIT_TIMEOUT_MS }
</file context>
| ); | ||
| openPages.push(broadcaster.page); | ||
|
|
||
| if (broadcaster.roomId) { |
There was a problem hiding this comment.
P2: When room creation succeeds but broadcaster setup fails, this condition still launches viewers; gate the viewer batch on broadcaster.ok instead of broadcaster.roomId.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At load-test/multi-room-scale.js, line 456:
<comment>When room creation succeeds but broadcaster setup fails, this condition still launches viewers; gate the viewer batch on `broadcaster.ok` instead of `broadcaster.roomId`.</comment>
<file context>
@@ -0,0 +1,604 @@
+ );
+ openPages.push(broadcaster.page);
+
+ if (broadcaster.roomId) {
+ console.log(`Room ID: ${broadcaster.roomId}`);
+ }
</file context>
| try { | ||
| await login(page, account.email, account.password); | ||
|
|
||
| const startTime = Date.now(); |
There was a problem hiding this comment.
P2: Viewer latency includes navigation and form rendering because startTime precedes page.goto(); move the timestamp immediately before form.requestSubmit().
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At load-test/multi-room-scale.js, line 319:
<comment>Viewer latency includes navigation and form rendering because `startTime` precedes `page.goto()`; move the timestamp immediately before `form.requestSubmit()`.</comment>
<file context>
@@ -0,0 +1,604 @@
+ try {
+ await login(page, account.email, account.password);
+
+ const startTime = Date.now();
+
+ await page.goto(
</file context>
| */ | ||
|
|
||
| async function launchBroadcaster(browser, account, roomIndex) { | ||
| const page = await browser.newPage(); |
There was a problem hiding this comment.
P2: With --emails using multiple accounts, all pages share one cookie jar; a reconnect can authenticate an existing room as the most recently logged-in account. Create an isolated browser context per room/account.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At load-test/multi-room-scale.js, line 199:
<comment>With `--emails` using multiple accounts, all pages share one cookie jar; a reconnect can authenticate an existing room as the most recently logged-in account. Create an isolated browser context per room/account.</comment>
<file context>
@@ -0,0 +1,604 @@
+ */
+
+async function launchBroadcaster(browser, account, roomIndex) {
+ const page = await browser.newPage();
+
+ page.on("console", (msg) => {
</file context>
|
|
||
| ## Roadmap gap this fills | ||
|
|
||
| The existing `load-test/sfu-capacity.js` piles **many viewers into ONE room**. |
There was a problem hiding this comment.
P3: load-test/sfu-capacity.js does not exist in the repo, so the "existing" reference (and the roadmap-gap claim that it currently covers single-room capacity) is inaccurate and will send readers on a dead-end. Update the reference to the actual load-test script, or clarify that this script is new and there is currently no single-room capacity test.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At load-test/results/MULTI-ROOM-SCALE.md, line 11:
<comment>`load-test/sfu-capacity.js` does not exist in the repo, so the "existing" reference (and the roadmap-gap claim that it currently covers single-room capacity) is inaccurate and will send readers on a dead-end. Update the reference to the actual load-test script, or clarify that this script is new and there is currently no single-room capacity test.</comment>
<file context>
@@ -0,0 +1,146 @@
+
+## Roadmap gap this fills
+
+The existing `load-test/sfu-capacity.js` piles **many viewers into ONE room**.
+That stresses a single router on a single worker, but it does **not** exercise
+the part of the system that actually scales horizontally: the worker pool.
</file context>



Puppeteer test that creates M concurrent rooms (broadcaster + V viewers each) to exercise mediasoup worker placement and dynamic worker scaling across rooms — you test many viewers in one room, this tests many rooms x workers.
Authored by Claude (Anthropic) via Claude Code. Not executed against a live backend — results are placeholders, not fabricated.
Summary by cubic
Adds a Puppeteer load test that creates M concurrent rooms (1 broadcaster + V viewers each) to exercise mediasoup worker placement and dynamic worker scaling across rooms, complementing the existing single-room
sfu-capacity.jstest.load-test/multi-room-scale.jswith per-room broadcaster/viewer launches, progressive CSV output, and multi-account round-robin support.load-test/results/MULTI-ROOM-SCALE.mddocumenting worker-placement andWORKER_THRESHOLDsampling; results are placeholders until the test runs against a live backend.Written for commit dae731b. Summary will update on new commits.