Skip to content

test(sfu): add multi-room scale test - #80

Open
Harxhit wants to merge 1 commit into
mainfrom
test/multi-room-scale
Open

test(sfu): add multi-room scale test#80
Harxhit wants to merge 1 commit into
mainfrom
test/multi-room-scale

Conversation

@Harxhit

@Harxhit Harxhit commented Aug 27, 2026

Copy link
Copy Markdown
Owner

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.


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.js test.

  • Adds load-test/multi-room-scale.js with per-room broadcaster/viewer launches, progressive CSV output, and multi-account round-robin support.
  • Adds load-test/results/MULTI-ROOM-SCALE.md documenting worker-placement and WORKER_THRESHOLD sampling; results are placeholders until the test runs against a live backend.

Written for commit dae731b. Summary will update on new commits.

Review in cubic

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>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ae15f744-44c5-4efb-926f-1582aa6492e2


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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**.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant