Skip to content

fix: report subscriptions actually created, not a flag-derived guess - #44

Open
fcostaoliveira wants to merge 1 commit into
masterfrom
fix/report-actual-subscriptions
Open

fix: report subscriptions actually created, not a flag-derived guess#44
fcostaoliveira wants to merge 1 commit into
masterfrom
fix/report-actual-subscriptions

Conversation

@fcostaoliveira

Copy link
Copy Markdown
Collaborator

Fixes #43.

TotalSubscriptions was total_channels * subscribers_per_channel, but -subscribers-per-channel does not drive subscription creation. Real fan-out is -clients × channels-per-connection, where channels-per-connection comes from -min/-max-number-channels-per-subscriber (both default 1). The reported number and the real one share no terms.

The failure mode is the awkward kind: a caller reads -subscribers-per-channel 10 as ten subscribers per channel — the help text says exactly that — and the output then confirms the belief with a figure derived from the same inert flag. Nothing signals the request went unmet.

Changes

  1. Count subscriptions as they're created, and report that. The old value was derived from inputs, so it could never detect a mismatch between request and reality.
  2. Warn when an explicit -subscribers-per-channel goes unmet, naming the flags that actually control fan-out. Gated on the flag being explicitly set (via flag.Visit) — the default differing from the real count is normal and not the caller's doing, so warning there would just be noise on every run.
  3. Fail loudly on non-dense placement in subscribe modes. Only dense is implemented and the branch had no else, so an unrecognised placement silently created zero subscribers and produced a clean zero-message result — which reads as "the server delivered nothing" rather than "we subscribed to nothing".

total_messages is recomputed from the corrected count, so the -messages termination target no longer derives from the unmet request.

Verified against a live server

case warning TotalSubscriptions actual
explicit -subscribers-per-channel 10, unmet ✅ fires 50 50
correct fan-out via channels-per-subscriber none 500 500
plain default run none 20 20
-subscribers-placement-per-channel sparse exits 1 with reason (was silently 0)

Before this change, case 1 reported 1000.

Downstream

This is live in the benchmark spec: the ...-50K-subscribers-5k-conns suite passes exactly the case-1 arguments, so it generates the same 5000 subscriptions as its 5000-subscriber sibling. Fixed separately in redis/redis-benchmarks-specification#500 — that YAML fix and this one are independent and each correct on its own.

I deliberately did not make -subscribers-per-channel control fan-out (option 1 in #43), since that changes behaviour for anyone currently passing it. Happy to do that instead if you'd prefer; this PR takes the option that only makes the reporting truthful.

TotalSubscriptions was computed as `total_channels * subscribers_per_channel`,
but -subscribers-per-channel does not drive subscription creation. Fan-out comes
from -clients x channels-per-connection, where channels-per-connection is set by
-min/-max-number-channels-per-subscriber (both default 1). The reported figure
and the real one share no terms.

The consequence is worse than a wrong label. A caller reasonably reads
"-subscribers-per-channel 10" as ten subscribers per channel -- the help text
says exactly that -- and the output then confirms the belief with a number
derived from the same inert flag. Nothing anywhere signals that the requested
fan-out did not happen. Verified live: `-clients 50 -subscribers-per-channel 10`
created 50 subscriptions and reported 1000.

Three changes:

* Count subscriptions as they are created and report that. The old value was
  derived from inputs, so it could never detect a mismatch between what was
  asked for and what happened.
* Warn when an *explicit* -subscribers-per-channel went unmet, naming the flags
  that do control fan-out. Only when explicitly set: the default differing from
  the real count is normal and not the caller's doing, so warning there would be
  noise.
* Fail loudly when subscribers-placement-per-channel is not "dense" in a
  subscribe mode. Only dense is implemented, and the branch had no else -- an
  unrecognised placement silently created zero subscribers and produced a clean
  zero-message result, which reads as "the server delivered nothing" rather than
  "we subscribed to nothing".

total_messages is recomputed from the corrected count, so the -messages
termination target is no longer derived from the unmet request.

Verified against a live server: explicit-but-unmet warns and reports 50;
correct fan-out reports 500 with no warning; a default run reports 20 with no
warning; sparse placement now exits 1 with the reason.

Refs #43
@github-actions

Copy link
Copy Markdown

🐳 Docker Build Validation

Docker build successful!

Platforms tested:

  • ✅ linux/amd64 (built and tested)
  • ✅ linux/arm64 (build validated)

Git SHA: 0cb58923fc771d178e0d0b0f5be8f5f80d3fea3e

Docker Hub Status: ✅ Docker Hub credentials configured

Image details:

  • Single platform: pubsub-sub-bench-pr:pr-44
  • Multi-platform: pubsub-sub-bench-pr:pr-44-multiplatform

Tests performed:

  • ✅ Docker Hub credentials check
  • ✅ Help command execution
  • ✅ Version output validation
  • ✅ Multi-platform build validation

The Docker image is ready for deployment! 🚀

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.

-subscribers-per-channel does not create subscriptions, but TotalSubscriptions is computed from it

1 participant