Repository navigation
cluster-mode: report endpoint count and connection fan-out - #489
Merged
Merged
Conversation
When --cluster-mode is set, surface the discovered topology at both the start of each run and in the results summary: - Startup (stderr, once per run): "[RUN #N] Cluster topology: K endpoints discovered (P primaries, R replicas)" followed by a per-endpoint list with the slot ranges each serves, then the total opened-connection fan-out (threads x conns/thread x endpoints) and, when --rate-limiting is set, the aggregate rate target. - Results summary (text + JSON): Cluster endpoints, Total connections, and the aggregate rate-limit target. Both sites derive counts from the same topology snapshot (build_topology_snapshot, group members only), so they agree and exclude the bootstrap seed connection. The aggregate rate target counts only request-generating connections (primaries always; replicas only when reads route to them), since idle replica connections never hit their per-connection limiter. Co-Authored-By: Claude Opus 4.8 <[email protected]>
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
A striped cluster advertises each node's slots as many disjoint CLUSTER SLOTS ranges, one shard_group each, all pointing at the same reused shard_connection. The previous snapshot emitted one entry per group, so a 9-node cluster reported "120 endpoints", inflated Total connections 13x (each client opens one connection per node, not per range), and printed 120 lines. Coalesce the snapshot by distinct host:port, merging each node's ranges, so endpoint count == node count == per-client connection fan-out. Print one compact line per node (slot count + range count) instead of the full range enumeration, capped at 40 with an "... and N more" footer. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 633db8f. Configure here.
Single-slot node printed '1 slots in 1 range'; derive the slot-word suffix from the slot count too. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…nt-summary # Conflicts: # run_stats.cpp
…948) The startup stderr block printed once per run (first CLUSTER SLOTS commit) while the results summary snapshots the topology at run end, so a mid-run topology refresh could leave the two reporting different endpoint/connection counts. Gate the startup print on a (run id, topology signature) pair instead of run id alone: it prints on the first commit and reprints whenever the endpoint/role/slot-range shape changes, so the last stderr block matches the run-end summary. Snapshot is also built before the gate now, so an empty topology never consumes the gate. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
This was referenced Jun 25, 2026
fcostaoliveira
added a commit
that referenced
this pull request
Jun 25, 2026
Follow-up to #489 fixing two Cursor Bugbot findings: hold the print-gate mutex across the whole topology emit (no interleaving/superseded blocks), and label Total connections / rate-limit target 'at full ramp' under --clients-start so the figure isn't read as the count already opened.
fcostaoliveira
added a commit
that referenced
this pull request
Jun 25, 2026
…ort) (#490) Backport of #489 (+ #491 fixes) to 2.4, re-implemented against 2.4's primary-only cluster model (m_slot_to_shard[16384]). Reports discovered endpoint count, total connection fan-out, and aggregate rate-limit target at benchmark start and in the results summary (text + JSON). Also enables the full CI matrix for the 2.4 branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
In
--cluster-mode, surface the discovered cluster topology at two places so operators can see how many nodes the load generator actually fans out to.Startup (stderr, once per run)
Results summary (text + JSON)
Notes
build_topology_snapshot(), committed shard-group members only), so they agree and exclude the bootstrap seed connection / dead sockets.--read-preferenceroutes reads to them — since idle replica connections never hit their per-connection limiter.CLUSTER SLOTScommits (when slot ranges are known).Review
Diff was put through a 7-lens adversarial review + verification pass (concurrency, slot-range reconstruction, count consistency, memory safety, output format, build/API integration, edge cases). All confirmed findings were fixed — notably a count discrepancy between the two print sites when the seed address differs from the CLUSTER-SLOTS-advertised address.
🤖 Generated with Claude Code
Note
Low Risk
Observability and reporting only; routing and benchmark logic are unchanged aside from calling the summary after topology commit.
Overview
In
--cluster-mode, the PR adds operator-visible topology reporting at startup and in the final run summary, both driven by the samebuild_topology_snapshot()view (distincthost:portnodes from committed shard groups, not bootstrap/dead sockets).After each successful
CLUSTER SLOTScommit,print_topology_summary()logs to stderr (mutex-gated per run and per topology signature): endpoint counts, a capped per-node slot/range list, total connections (threads × conns/thread × endpoints), and when--rate-limitingis set, an aggregate req/s target that counts only traffic-bearing connections (primaries plus replicas when reads can use them).benchmark_config::current_run_idis set at the start ofrun_benchmark()so those lines are labeled[RUN #N]. At run end,run_statsstores topology counts from one client snapshot; the text/JSON “run information” block adds cluster endpoints, total connections, and the same aggregate rate-limit figure so it matches the stderr startup block.Non-cluster runs are unchanged.
Reviewed by Cursor Bugbot for commit 9ba2ed9. Bugbot is set up for automated code reviews on this repo. Configure here.