-
Notifications
You must be signed in to change notification settings - Fork 0
test(media): add real media-plane fan-out capacity test #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,13 @@ import SystemLogs from "../components/broadcaster/SystemLogs"; | |
| import LiveChat from "../components/broadcaster/LiveChat"; | ||
| import ReactionOverlay from "../components/reactions/ReactionOverlay"; | ||
|
|
||
| declare global { | ||
| interface Window { | ||
| __csRoomId?: string; | ||
| __csLiveAt?: number; | ||
| } | ||
| } | ||
|
|
||
| interface Log { | ||
| message: string; | ||
| timestamp: Date; | ||
|
|
@@ -58,6 +65,7 @@ export default function BroadcasterPage() { | |
| const room = await broadcaster.createRoom(); | ||
|
|
||
| setRoomId(room.id); | ||
| window.__csRoomId = room.id | ||
|
|
||
| log("Fetching RTP capabilities..."); | ||
|
|
||
|
|
@@ -84,6 +92,7 @@ export default function BroadcasterPage() { | |
| await broadcaster.startProducing(stream); | ||
|
|
||
| setIsLive(true); | ||
| window.__csLiveAt = Date.now(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: The test hooks are write-only: Prompt for AI agents |
||
|
|
||
| log("Broadcast started successfully."); | ||
| } catch (err: any) { | ||
|
|
@@ -258,6 +267,7 @@ export default function BroadcasterPage() { | |
| {!isLive ? ( | ||
| <button | ||
| onClick={startBroadcast} | ||
| id="live-start-button" | ||
| className="flex items-center gap-1.5 rounded-xl bg-[#3fcf9e] px-4 py-2 text-sm font-semibold text-[#04241a] transition hover:bg-[#5fdcb2]" | ||
| > | ||
| <Play size={15} /> Go live | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||||||||||
| import { Navigate, Outlet } from "react-router-dom"; | ||||||||||||||
| import { useEffect , useState} from "react"; | ||||||||||||||
| import { connectSocket, disconnectSocket } from "../socket"; | ||||||||||||||
|
Check warning on line 3 in frontend/src/router/ProtectedRoute.tsx
|
||||||||||||||
| import useAuth from "../hooks/useAuth"; | ||||||||||||||
|
|
||||||||||||||
| export default function ProtectedRoute() { | ||||||||||||||
|
|
@@ -19,9 +19,9 @@ | |||||||||||||
| }) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| return () => { | ||||||||||||||
| disconnectSocket(); | ||||||||||||||
| }; | ||||||||||||||
| // return () => { | ||||||||||||||
| // disconnectSocket(); | ||||||||||||||
| // }; | ||||||||||||||
|
Comment on lines
+22
to
+24
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: When Prompt for AI agents
Suggested change
|
||||||||||||||
| }, [authenticated]); | ||||||||||||||
|
|
||||||||||||||
| if (loading) { | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,6 +11,7 @@ export function connectSocket() { | |||||||||
| } | ||||||||||
|
|
||||||||||
| socket = io(window.location.origin); | ||||||||||
| (window as any).__csSocket = socket; | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: This exposes the internal Socket.IO instance on window.__csSocket for every visitor, purely so load-test/media-fanout-capacity.js can reach it. In production this pollutes the global namespace and hands any injected or third-party script a fully-connected authenticated socket. Gate the test hook behind a build/run env check (e.g. Prompt for AI agents
Suggested change
|
||||||||||
|
|
||||||||||
| socket.on("connect", () => { | ||||||||||
| console.log("Client connected", socket?.id); | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| timestamp,viewers,joinP50,joinP99,firstFrameP50,firstFrameP99,meanBitrateKbps,meanLossPct,meanFps,failures | ||
| 2026-08-30T17:12:22.422Z,10,1546,1868,2914,3069,444.2,0.00,11.0,0 | ||
| 2026-08-30T17:12:46.401Z,20,1244,1796,2057,2789,440.4,0.00,10.3,0 | ||
| 2026-08-30T17:13:11.969Z,30,1808,2069,2540,3342,458.6,0.00,9.6,0 | ||
| 2026-08-30T17:13:39.728Z,40,2122,2878,3025,4370,442.0,0.00,9.4,0 | ||
| 2026-08-30T17:14:13.420Z,50,3691,4669,5507,6757,430.4,0.00,9.5,0 | ||
| 2026-08-30T17:14:54.392Z,60,5122,6769,6866,9592,262.1,0.00,10.2,0 | ||
| 2026-08-30T17:15:45.218Z,70,6853,8490,8529,10358,105.7,0.00,7.8,0 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: This results file is committed as realistic capacity data under a PR titled "real media-plane fan-out capacity test", yet the author's own PR description states the results were never run against a live backend and are a placeholder. The rows read as established findings — 0.00% loss/0 failures at every load step even as bitrate collapses 444→105 kbps and first-frame P99 reaches ~10.3s at 70 viewers — and the filename media-fanout-100.csv implies 100-viewer capacity while the data (and the in-repo results doc) only reach 70. A future reader will cite these as measured capacity and the 100-viewer ceiling. Non-zero loss/failures would normally appear at the observed degradation point, so the all-zero metrics are not self-evidently measured. Run the test against a live backend and commit the real numbers, or clearly mark the file (and results doc) as placeholder data so it is not mistaken for a real capacity finding. Prompt for AI agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: This debug line is redundant and does not show the value it intends to. The winston customFormat in logging.ts renders only the message, so the
reasonpassed as the second argument is discarded and the log prints just '[REASON]'. The very next line already logs the reason. Remove this line and rely on the existing disconnect log.Prompt for AI agents