Skip to content

feat(scripts): server metrics measure many threads working at once with one client - #41371

Merged
juliusmarminge merged 1 commit into
mainfrom
perf/server-metrics-working
Nov 23, 2026
Merged

juliusmarminge merged 1 commit into
mainfrom
perf/server-metrics-working

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

None of the scenarios measured what the maintainers care about most: many threads working at once with one or a few clients attached.

working runs 5, then 10, then 20 threads, each in a worktree of its own (thread start --worktree main), all running turns back to back at the same time. One client is attached over the real WebSocket RPC and subscribed to all of them like the web client (shell, VCS status, every thread, activity reports). That client sends each turn as a message.dispatch and sees the run end on its thread subscription, so turns don't spawn a CLI per send.

Each turn is realistic: the fake API streams a 150-word reply that ends in a Write tool call into the agent's working directory (read from the CLI's prompt), the real claude CLI writes the file, the follow-up streams a short answer, and the turn's checkpoint captures a real change.

Per window: CPU, wakeups, RSS, heap after GC, ELD p50/p99/max, GC count/pause, turns per minute, send to the first API request, the last reply byte to the client seeing the run end, and whole-turn time. Fits over the windows give heap, RSS, CPU and p99 delay per working thread. compare treats *PerMin as higher-is-better (table test).

Cups, ab <same> <same> --rounds 5 --only working: medians of 10 runs on a quiet machine (load 1.9–4, other processes ≤ 0.11 cores):

threads server CPU ELD p50 / p99 / max GC pause turns/min to request turn end turn
5 104% 3.5 / 32.2 / 44 ms 400 ms 37.8 2.8 s 3.0 s 7.7 s
10 108% 14.2 / 33.7 / 57 ms 409 ms 37.7 4.2 s 8.3 s 15.1 s
20 107% 16.5 / 35.8 / 58 ms 421 ms 39.0 4.5 s 14.8 s 22.2 s

Each working thread adds 0.22 MB of heap and 1.26 MB of RSS. With --no-agent-scope (6 runs) the shape is the same: 32–37 turns/min, and turn end 3.7 s → 16.4 s.

Throughput stays at ~38 turns/min whether 5 or 20 threads work. The server sits just above one core, and p50 loop delay climbs from 3.5 ms to 16.5 ms. The time from a reply's last byte to the client seeing the run end grows 5× (3.0 s → 14.8 s). The server, not the agents, is the bottleneck, and this is the scenario to hill-climb on. It is also the steadiest scenario under A/A: every per-window metric that gates resolves a 6–29% change per 5-round ab, and the floors in NOISE_RULES come from these runs (table on #41370). On a machine at load 21 the same scenario showed the same plateau (31–33 turns/min) with turn end at 16.7 s.

Stacked on #41370.

Model: Claude Opus 5.5, harness: Claude Code in T3 Code.

🤖 Generated with Claude Code

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Nov 23, 2026
@juliusmarminge
juliusmarminge force-pushed the perf/server-metrics-working branch from fdf7f10 to 3f93f69 Compare November 23, 2026 10:31
@juliusmarminge
juliusmarminge force-pushed the perf/server-metrics-noise branch from c035771 to 027d515 Compare November 23, 2026 10:31
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for ac44961.

This comment will update automatically after the next completed run.

@juliusmarminge
juliusmarminge force-pushed the perf/server-metrics-working branch from 3f93f69 to 416b181 Compare November 23, 2026 14:02
@github-actions github-actions Bot added size:XL 500-999 changed lines (additions + deletions). size:L 100-499 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). size:XL 500-999 changed lines (additions + deletions). labels Nov 23, 2026
@juliusmarminge
juliusmarminge force-pushed the perf/server-metrics-working branch from 416b181 to ac44961 Compare November 23, 2026 14:15
Base automatically changed from perf/server-metrics-noise to main November 23, 2026 14:19
…th one client

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge
juliusmarminge force-pushed the perf/server-metrics-working branch from ac44961 to 1268612 Compare November 23, 2026 14:21
@juliusmarminge
juliusmarminge merged commit 2041936 into main Nov 23, 2026
34 checks passed
@juliusmarminge
juliusmarminge deleted the perf/server-metrics-working branch November 23, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant