test(redis): add cross-pod adapter throughput test - #82
Conversation
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>
|
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.
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); |
There was a problem hiding this comment.
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 }); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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>
| 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 \ |
There was a problem hiding this comment.
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>




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.
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.
load-test/redis-adapter-throughput.jsconnects receivers round-robin to>=2pod URLs sharing Redis, has a subset emit chat messages at a fixed rate, and reports fan-out latency, delivery ratio, and aggregate broadcast rate.load-test/results/REDIS-ADAPTER-THROUGHPUT.mdexplains why>=2pods are required, how to sample Redis during the run, and how to interpret the numbers.Written for commit 73c39c3. Summary will update on new commits.