Skip to content

test(redis): add cross-pod adapter throughput test - #82

Open
Harxhit wants to merge 1 commit into
mainfrom
test/redis-adapter-throughput
Open

test(redis): add cross-pod adapter throughput test#82
Harxhit wants to merge 1 commit into
mainfrom
test/redis-adapter-throughput

Conversation

@Harxhit

@Harxhit Harxhit commented Aug 27, 2026

Copy link
Copy Markdown
Owner

socket.io-client test that spreads receivers across >=2 pods and drives heavy chat/reaction fan-out so every broadcast traverses the Redis sharded adapter, surfacing Redis pub/sub ops/CPU as the scaling bottleneck.

  • load-test/redis-adapter-throughput.js — cross-pod fan-out; delivery + latency + broadcast rate
  • load-test/results/REDIS-ADAPTER-THROUGHPUT.md — why >=2 pods, redis-cli sampling, interpretation

Authored by Claude (Anthropic) via Claude Code. Not executed against a live backend — results are placeholders, not fabricated.


Summary by cubic

Adds a cross-pod Redis adapter throughput load test for Socket.IO, spreading receivers across multiple pod URLs and driving fan-out to measure adapter capacity and expose Redis pub/sub operations and CPU as the scaling bottleneck.

  • New load-test/redis-adapter-throughput.js connects receivers round-robin to >=2 pod URLs sharing Redis, has a subset emit chat messages at a fixed rate, and reports fan-out latency, delivery ratio, and aggregate broadcast rate.
  • New load-test/results/REDIS-ADAPTER-THROUGHPUT.md explains why >=2 pods are required, how to sample Redis during the run, and how to interpret the numbers.
  • Test has not yet been executed against a live backend; results in the doc are placeholders, not fabricated.

Written for commit 73c39c3. Summary will update on new commits.

Review in cubic

socket.io-client test that spreads receivers across >=2 pods and drives heavy
chat/reaction fan-out so every broadcast traverses the Redis sharded adapter,
surfacing Redis pub/sub ops/CPU as the scaling bottleneck.

- load-test/redis-adapter-throughput.js — cross-pod fan-out; delivery + latency + broadcast rate
- load-test/results/REDIS-ADAPTER-THROUGHPUT.md — why >=2 pods, redis-cli sampling, interpretation

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: ee9ee734-c8ce-46f9-ae44-de7168abf037


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

Quality Gate Failed Quality Gate failed

Failed conditions
6.2% Duplication on New Code (required ≤ 3%)
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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

4 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/redis-adapter-throughput.js">

<violation number="1" location="load-test/redis-adapter-throughput.js:267">
P1: When this test uses a pod other than the room owner, `joinRoom` fails before any receiver joins, so it cannot exercise cross-pod fan-out. Route room joins to the owner or provision valid room state on every target pod before running this test.</violation>

<violation number="2" location="load-test/redis-adapter-throughput.js:291">
P2: The load loop never emits `chat:reactions`, so the reaction fan-out promised by the PR is not exercised. Add a reaction stream and delivery counters, or remove reactions from the test description.</violation>

<violation number="3" location="load-test/redis-adapter-throughput.js:404">
P2: When any requested pod fails to accept receivers, the script silently runs with the surviving sockets and can report single-pod traffic as cross-pod throughput. Require every requested URL to have joined receivers, and abort before starting senders when coverage is incomplete.</violation>
</file>

<file name="load-test/results/REDIS-ADAPTER-THROUGHPUT.md">

<violation number="1" location="load-test/results/REDIS-ADAPTER-THROUGHPUT.md:71">
P3: Option B hardcodes an author-specific path (`/home/harshit/CrowdStream/...`) that only works on the author's machine, so the fallback run instruction breaks for everyone else. Since the script already ships in `load-test/`, drop the hardcoded `NODE_PATH` and point users at the repo-local `load-test/node_modules` (e.g. `NODE_PATH="$PWD/load-test/node_modules"` or simply run from `load-test/`).</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

});

// 2. JOIN ROOM (required to send/receive that room's chat)
const { response } = await ackWithTimeout(socket, "joinRoom", ROOM_ID);

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: When this test uses a pod other than the room owner, joinRoom fails before any receiver joins, so it cannot exercise cross-pod fan-out. Route room joins to the owner or provision valid room state on every target pod before running this test.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At load-test/redis-adapter-throughput.js, line 267:

<comment>When this test uses a pod other than the room owner, `joinRoom` fails before any receiver joins, so it cannot exercise cross-pod fan-out. Route room joins to the owner or provision valid room state on every target pod before running this test.</comment>

<file context>
@@ -0,0 +1,452 @@
+    });
+
+    // 2. JOIN ROOM (required to send/receive that room's chat)
+    const { response } = await ackWithTimeout(socket, "joinRoom", ROOM_ID);
+
+    if (!response?.success) {
</file context>

// cslt|<runId>-<senderIdx>-<seq>|<sentAt> (1..500 chars, well under cap)
const message = `cslt|${RUN_ID}-${senderIdx}-${seq}|${Date.now()}`;

socket.emit("chat:message", { roomId: ROOM_ID, message });

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: The load loop never emits chat:reactions, so the reaction fan-out promised by the PR is not exercised. Add a reaction stream and delivery counters, or remove reactions from the test description.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At load-test/redis-adapter-throughput.js, line 291:

<comment>The load loop never emits `chat:reactions`, so the reaction fan-out promised by the PR is not exercised. Add a reaction stream and delivery counters, or remove reactions from the test description.</comment>

<file context>
@@ -0,0 +1,452 @@
+    // cslt|<runId>-<senderIdx>-<seq>|<sentAt>  (1..500 chars, well under cap)
+    const message = `cslt|${RUN_ID}-${senderIdx}-${seq}|${Date.now()}`;
+
+    socket.emit("chat:message", { roomId: ROOM_ID, message });
+    state.totalSent += 1;
+  }, intervalMs);
</file context>


await Promise.allSettled(connectRuns);

const connected = receivers.filter(Boolean);

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 any requested pod fails to accept receivers, the script silently runs with the surviving sockets and can report single-pod traffic as cross-pod throughput. Require every requested URL to have joined receivers, and abort before starting senders when coverage is incomplete.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At load-test/redis-adapter-throughput.js, line 404:

<comment>When any requested pod fails to accept receivers, the script silently runs with the surviving sockets and can report single-pod traffic as cross-pod throughput. Require every requested URL to have joined receivers, and abort before starting senders when coverage is incomplete.</comment>

<file context>
@@ -0,0 +1,452 @@
+
+  await Promise.allSettled(connectRuns);
+
+  const connected = receivers.filter(Boolean);
+
+  console.log(
</file context>
Suggested change
const connected = receivers.filter(Boolean);
const connected = receivers.filter(Boolean);
if (connected.length !== NUM_RECEIVERS || NUM_RECEIVERS < URLS.length) {
throw new Error(
`Cross-pod test requires all ${NUM_RECEIVERS} receivers to join across ${URLS.length} URLs.`
);
}

--receivers 300 --senders 30 --rate 5 --durationMs 30000

# Option B: run in place, borrowing the installed dependency
NODE_PATH=/home/harshit/CrowdStream/load-test/node_modules \

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: Option B hardcodes an author-specific path (/home/harshit/CrowdStream/...) that only works on the author's machine, so the fallback run instruction breaks for everyone else. Since the script already ships in load-test/, drop the hardcoded NODE_PATH and point users at the repo-local load-test/node_modules (e.g. NODE_PATH="$PWD/load-test/node_modules" or simply run from load-test/).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At load-test/results/REDIS-ADAPTER-THROUGHPUT.md, line 71:

<comment>Option B hardcodes an author-specific path (`/home/harshit/CrowdStream/...`) that only works on the author's machine, so the fallback run instruction breaks for everyone else. Since the script already ships in `load-test/`, drop the hardcoded `NODE_PATH` and point users at the repo-local `load-test/node_modules` (e.g. `NODE_PATH="$PWD/load-test/node_modules"` or simply run from `load-test/`).</comment>

<file context>
@@ -0,0 +1,179 @@
+  --receivers 300 --senders 30 --rate 5 --durationMs 30000
+
+# Option B: run in place, borrowing the installed dependency
+NODE_PATH=/home/harshit/CrowdStream/load-test/node_modules \
+node /tmp/cs-tests/redis-adapter-throughput/redis-adapter-throughput.js \
+  --urls "http://pod-a:3000,http://pod-b:3000" \
</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