Repository navigation
perf(amber): drain only sendable messages from the congestion queue - #9630
Draft
Matthew-DWM wants to merge 1 commit into
Draft
Matthew-DWM wants to merge 1 commit into
Matthew-DWM wants to merge 1 commit into
Conversation
Read and remove only the messages that fit in the congestion window instead of scanning the whole queue on every ACK, and keep the queue's array shrinking. Add a transfer-service test for FIFO sends as the window shrinks and reopens.
Contributor
Automated Reviewer SuggestionsBased on the
|
Matthew-DWM
marked this pull request as draft
November 23, 2026 17:49
This branch has not been deployed
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 changes were proposed in this PR?
Each channel's congestion window caps how many sent messages can wait for an acknowledgment (ACK); the rest wait in a queue. On every ACK,
CongestionControl.dequeueNtook the oldest messages that fit by runningdequeueAllwith a counting predicate, which visits every queued message and shifts the unsent ones forward. Past the slow-start threshold each ACK frees two slots, so emptying a backlog of n messages took about n²/4 visits.dequeueNreads the firstmin(n, queue.size)messages and removes them with onequeue.remove(0, count), so an ACK costs only the messages it sends.remove(0, count)keeps the queue's existing behavior of shrinking its backing array once a large backlog drains;dequeueWhilewould leave the array at its peak size.Any related issues, documentation, discussions?
Closes #9629
How was this PR tested?
PekkoMessageTransferServiceSpecgainsreceiveAck should drain buffered messages in FIFO order when the congestion window reopens. It sends 80 messages on one channel and checks exactly which have been sent after every ACK: as the window grows, after a late ACK shrinks it below the number in flight, while it recovers, and when new sends arrive behind a backlog. It guards behavior this PR keeps, so it passes both before and after the change.sbt 'WorkflowExecutionService/testOnly *CongestionControlSpec *PekkoMessageTransferServiceSpec'All 26 tests pass, as do
scalafmtCheckandscalafix --checkforWorkflowExecutionService.ACK handling alone. Each version's
CongestionControlsent a queued backlog, handling one prompt ACK at a time until every message was sent and acknowledged. Median of 30 timings per version, from 3 JVMs each:Whole workflow. A 25,000-row Text Input → Count workflow on one machine, timed from start to reading the result, which was correct in every run. Median of 40 runs per version, from 4 JVMs each:
On one machine ACKs return almost at once, so the queue stays nearly empty and both versions take the same time. Between machines each ACK waits for a network round trip, and messages pile up. The last row imitates that by holding every data ACK for 20 ms in both versions. There, all 40 runs of this PR were faster than all 40 runs before it.
Was this PR authored or co-authored using generative AI tooling?
Generated-by: OpenAI Codex (GPT-6.2 Sol), Claude Code (Claude Opus 5.5)