Repository navigation
perf(rabbitmq): per-endpoint consumer dispatch concurrency (GH-3492) - #3672
Merged
Merged
Conversation
…r-acking in-flight deliveries (GH-3492) Wave 2 of the RabbitMQ performance deep dive. RO6 -- ConsumerDispatchConcurrency is now settable per listening endpoint instead of only transport-wide. This is the cheapest lever there is for the Inline default: on the local rig, an Inline listener with a 5ms handler under a 2,000 msg/s load went from 164 msg/s at the client default of 1 to 828 msg/s at 5 and 1,999 msg/s at 20, where it kept up with the entire offered load. It costs no extra channels or connections, unlike ListenerCount. RO2 -- every completion used to ack its delivery tag with multiple: true, which tells the broker "and every lower tag on this channel too". Completions finish out of order under any concurrent listener (Buffered or Durable with MaxDegreeOfParallelism above 1), so completing tag 10 silently acked tags 1-9 while they were still in the handler pipeline, and a crash then lost them. Now multiple: false. Coalescing acks into cumulative ones behind a batching window was prototyped and REJECTED on measurement: basic.ack is a fire-and-forget AMQP frame, not an RPC, so batching saves no round trips while the extra channel hops cost ~10% of max inline throughput (37.7-39.5k/s vs a 41.0-44.2k/s baseline, three runs each). The native RabbitMQ.Client twin acks per message too, which is why acks were never the inline gap. Recorded in the plan's ledger. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Member
Author
Full measured detailAdding the latency percentiles behind the throughput table in the description — they are the RO6 — Inline listener, 5ms handler, 2,000 msg/s offered
At 1 and 5 the listener never catches up and the backlog grows without bound — at 5 the delivery Ack change —
|
| Build | Runs |
|---|---|
origin/main |
43,899.8 / 41,024.9 / 44,201.3 msg/s |
| RO2 ack coalescing prototype (rejected) | 39,501 / 37,715 / 37,818.9 msg/s |
This branch (multiple: false) |
42,723.8 / 41,295 msg/s |
native RabbitMQ.Client twin |
50,965.1 msg/s |
The shipped change is inside baseline run-to-run variance. The rejected prototype is not — three
runs, no overlap with baseline.
CI caught what local runs did not: flipping BasicAckAsync to multiple: false leaks deliveries. The cumulative sweep is load-bearing -- it is currently the only thing settling deliveries that some paths never acknowledge at all. Measured after a full Wolverine.RabbitMQ.Tests run against a freshly deleted queue: origin/main leaves 0 messages in quorum1, the multiple:false build leaves 1. That leaked message then fails quorum_queue_compliance.will_requeue_and_increment_attempts on the next run, which is exactly what CI hit twice on fresh containers while two sibling PRs off the same base -- carrying no RabbitMQ changes -- stayed green. Reverted here so the measured RO6 win is not held hostage to it. The ack change moves to its own branch, where the leaking settle path gets fixed first rather than papered over by the sweep. This PR is now RO6 only: per-endpoint ConsumerDispatchConcurrency, plus the rejected-on-measurement ack coalescing result recorded in the ledger. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Wave 2 of the RabbitMQ performance deep dive (GH-3492). Wave 1 was #3512.
Scope note: this PR originally also flipped the acknowledgement semantics. CI caught a real
regression there, so that half has been split onto its own branch — see the bottom of this
description. What remains here is RO6 plus a measured negative result.
RO6 —
ConsumerDispatchConcurrencyis now per endpointThe RabbitMQ client's consumer dispatch concurrency was only settable transport-wide, through
ConfigureChannelCreation. That made the single most effective lever for RabbitMQ'sInlinedefault an all-or-nothing process setting.
Measured on the in-repo rig (
KafkaPerfRig, rabbit harness), Inline listener, 1Kb payloads, 5mssimulated handler, 2,000 msg/s offered load, 10s warmup / 30s measured:
ConsumerDispatchConcurrencyThe throughput multiples (5.1x, 12.2x) understate it. At 1 and 5 the listener never catches up and
the backlog grows without bound — at 5 the delivery p50 is 22.9 seconds. At 20 it matches the
full offered load and delivery p50 collapses to 1.5 ms. Handler time is flat across all three cells,
so this is scheduling, not handler drift. Unlike
ListenerCount, it costs no extra channels orconnections.
RO2 ack coalescing — built, measured, rejected
The plan proposed coalescing acks into cumulative ones behind a batching window. I built it
(BatchingChannel + contiguous watermark + cumulative ack, 7 unit tests green) and threw it away on
the numbers,
r-max-inline(uncapped publisher, 0ms handler):origin/mainbaselineRabbitMQ.Clienttwin~10% regression, three runs each, no overlap between the distributions. The premise was wrong:
basic.ackis a fire-and-forget AMQP frame, not an RPC, so coalescing saves zero round trips whilethe extra channel hops cost real throughput. The native twin acks per message too and still runs at
51k/s, which is the direct evidence that acks were never the inline gap — Wolverine inline sits at
~84% of the native twin, and whatever the remaining 16% is, it is not acknowledgement.
Recorded in
RABBITMQ-PERF-DEEP-DIVE-PLAN.md§6 so nobody re-litigates it.Split out: the ack semantics change
BasicAckAsync(tag, multiple: true)also acks every lower delivery tag on the channel, soout-of-order completion under a concurrent listener acks messages still in the handler pipeline.
That is a genuine at-least-once hole and I originally fixed it here.
CI proved it is not a one-liner. The cumulative sweep is load-bearing — it is currently the only
thing settling deliveries that some paths never acknowledge at all. Measured after a full
Wolverine.RabbitMQ.Testsrun against a freshly deleted queue:quorum1after the full suiteorigin/mainmultiple: falseThat leaked message then fails
quorum_queue_compliance.will_requeue_and_increment_attemptson thenext run against the same broker, which is exactly what CI hit — twice, on fresh containers, 2-of-2
retry attempts — while #3673 and #3674, branched off the same base with zero RabbitMQ changes, kept
CIRabbitMQ green. Locally the same test passes against a clean queue and fails against a dirty one
on both branches, which is why my local baseline missed it.
The fix belongs with the leaking settle path, not with keeping the sweep (prime suspect:
RabbitMqInteropFriendlyCallback.MoveToErrorsAsyncposts a copy to the dead-letter queue and neveracks or nacks the original, unlike
RabbitMqChannelCallback.moveToErrorQueueAsyncwhich nacks).Branch:
fix/3492-rabbitmq-ack-semantics.Tests
New unit coverage for the per-endpoint knob (
consumer_dispatch_concurrency_3492). FullWolverine.RabbitMQ.Testsresults are on the CI run for this branch.GH-3492 stays open for the remaining items: the ack semantics fix, RO5 (back-pressure churn), O1b
(batched mark-handled), RO4 (publisher-confirm windowing).
🤖 Generated with Claude Code