Skip to content

cluster-mode: report endpoint count and connection fan-out (2.4 backport) - #490

Merged
fcostaoliveira merged 3 commits into
2.4from
feat/cluster-endpoint-summary-2.4
Jun 25, 2026
Merged

fcostaoliveira merged 3 commits into
2.4from
feat/cluster-endpoint-summary-2.4

Conversation

@fcostaoliveira

@fcostaoliveira fcostaoliveira commented Jun 25, 2026 •

Copy link
Copy Markdown
Collaborator

Backport of #489 to the 2.4 branch.

Why a re-implementation (not a cherry-pick)

2.4 predates the --read-preference / shard_group infrastructure (#456) that #489 was built on. The 2.4 cluster client is primary-only and uses m_slot_to_shard[16384] + m_connections, with no shard_group/endpoint_snapshot/replica routing. A straight cherry-pick conflicts in 4 files on missing types, so this re-implements the same user-facing feature against 2.4's model.

What

In --cluster-mode:

  • Startup (stderr) — once per run, reprinting on a mid-run topology shape change:
    [RUN #1] Cluster topology: 9 endpoints discovered (9 primaries)
               10.0.0.1:7000          primary    1820 slots in 13 ranges
               ...
    [RUN #1] Total connections: 128 threads x 3 conns/thread x 9 endpoints = 3456
    [RUN #1] Rate limit: 34 req/s/conn -> 117504 req/s aggregate target
    
  • Results summary (text + JSON) — Cluster endpoints, Total connections, Aggregate rate-limit target.

Notes

  • Endpoints are counted by distinct host:port (coalesced from the slot map), so the count equals the per-client connection fan-out and Total connections is the real opened-connection count.
  • Startup block and run-end summary share one snapshot source, so they agree.
  • Primary-only (2.4 has no replica routing), so the read-preference-aware rate nuance from cluster-mode: report endpoint count and connection fan-out #489 doesn't apply here — every connection generates traffic.
  • Non-cluster runs are unchanged.

🤖 Generated with Claude Code


Note

Low Risk
Changes are mostly logging and summary output on the cluster path; routing and request handling are unchanged, and non-cluster runs are unaffected.

Overview
Cluster-mode observability (2.4 backport) adds reporting of discovered distinct host:port endpoints, total connection fan-out (threads × conns/thread × endpoints), and optional aggregate rate-limit targets, using the primary-only m_slot_to_shard + m_connections model.

After CLUSTER SLOTS commits, cluster_client builds a topology snapshot and prints a gated [RUN #N] Cluster topology block on stderr (once per run/signature, reprints on mid-run topology changes). At run end, the same snapshot is captured into run_stats so the text/JSON run information section matches the startup lines. benchmark_config::current_run_id labels those messages.

CI workflows now also run on push/PR to the 2.4 branch alongside master/main.

Reviewed by Cursor Bugbot for commit 76dd1e2. Bugbot is set up for automated code reviews on this repo. Configure here.

…ort)

Backport of #489 to the 2.4 branch, re-implemented against 2.4's
primary-only cluster model (m_slot_to_shard[16384] + m_connections;
2.4 predates the --read-preference/shard_group infrastructure #489 was
built on, so a straight cherry-pick was not possible).

In --cluster-mode, report the discovered topology at benchmark start and
in the results summary:
- Startup (stderr, once per run; reprints on mid-run shape change):
  "[RUN #N] Cluster topology: K endpoints discovered (K primaries)",
  one compact line per node (slot count + range count), then the total
  opened-connection fan-out (threads x conns x endpoints) and, when
  --rate-limiting is set, the aggregate target.
- Results summary (text + JSON): Cluster endpoints, Total connections,
  Aggregate rate-limit target.

Counts are derived by coalescing the slot map by distinct host:port, so
the endpoint count equals the per-client connection fan-out. The startup
block and the run-end summary share the same snapshot source. Primary
only (2.4 has no replica routing).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@jit-ci

jit-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

Add "2.4" to the push/pull_request branch filters across all workflows
so PRs targeting and pushes to the 2.4 branch trigger the full CI matrix
(build/test/ASAN/TSAN/UBSan/code-style), not just the external app checks.
Quoted to keep YAML from parsing 2.4 as a float.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ 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 45468ae. Configure here.

Comment thread cluster_client.cpp Resolved
Comment thread cluster_client.cpp Resolved
…#490)

- Hold the print-gate mutex across the whole topology emit so two workers
  can't interleave blocks or print a superseded topology after a newer one.
- With the --clients-start staircase ramp, label Total connections /
  rate-limit target as 'at full ramp' (cfg.clients is the peak value), so
  the figure isn't read as the count already opened.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@fcostaoliveira
fcostaoliveira merged commit 6de788c into 2.4 Jun 25, 2026
69 checks passed
@fcostaoliveira fcostaoliveira mentioned this pull request Jul 1, 2026
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