Matthew-DWM opened a new pull request, #9630:
URL: https://github.com/apache/texera/pull/9630
### 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.dequeueN` took the oldest messages that fit by running
`dequeueAll` with 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.
```
Before: ACK frees 2 slots, 10,000 queued -> visit all 10,000 and shift
the rest -> send the oldest 2
After: ACK frees 2 slots, 10,000 queued -> read and remove the first 2
-> send the oldest 2
```
- `dequeueN` reads the first `min(n, queue.size)` messages and removes them
with one `queue.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; `dequeueWhile` would leave the array
at its peak size.
- Sending order, the window, ACK handling, byte credits and resends are
unchanged.
### Any related issues, documentation, discussions?
Closes #9629
### How was this PR tested?
`PekkoMessageTransferServiceSpec` gains `receiveAck 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.
```sh
sbt 'WorkflowExecutionService/testOnly *CongestionControlSpec
*PekkoMessageTransferServiceSpec'
```
All 26 tests pass, as do `scalafmtCheck` and `scalafix --check` for
`WorkflowExecutionService`.
**ACK handling alone.** Each version's `CongestionControl` sent 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:
| Messages queued | Before | After |
| ---: | ---: | ---: |
| 30 | 2.8 µs | 2.0 µs |
| 1,000 | 0.81 ms | 0.10 ms |
| 10,000 | 73.6 ms | 1.2 ms |
**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:
| Setting | Most messages queued | Before | After | Change (95% CI) |
| --- | ---: | ---: | ---: | ---: |
| 400-row batches (default) | 0 | 280 ms | 278 ms | −1% (−7% to +2%) |
| 1-row batches | 30 | 348 ms | 344 ms | −1% (−7% to +3%) |
| 1-row batches, data ACKs held 20 ms | about 12,000 | 738 ms | 640 ms |
−13% (−15% to −12%) |
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)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]