Matthew-DWM opened a new issue, #9629: URL: https://github.com/apache/texera/issues/9629
### Task Summary Each Amber channel caps how many sent messages can wait for an acknowledgment (ACK); the rest wait in a queue. Once the window is past its slow-start threshold, each ACK frees one slot and grows the window by one, so the sender sends the two oldest queued messages. To take them, `dequeueN` calls `dequeueAll` with a counting predicate, which visits every queued message and shifts the unsent ones forward ([CongestionControl.scala#L78-L89](https://github.com/apache/texera/blob/95e2748b97e0cdd29069971fe74349ac5f28134b/amber/src/main/scala/org/apache/texera/amber/engine/architecture/messaginglayer/CongestionControl.scala#L78-L89)). Emptying a backlog of n messages two at a time therefore costs about n²/4 visits: 25 million for 10,000 messages. ``` 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 ``` The queue gets this deep when messages are small and the receiver acknowledges slowly. Control channels skip byte-based flow control ([PekkoMessageTransferService.scala#L93-L95](https://github.com/apache/texera/blob/95e2748b97e0cdd29069971fe74349ac5f28134b/amber/src/main/scala/org/apache/texera/amber/engine/architecture/common/PekkoMessageTransferService.scala#L93-L95)), and flow control lets up to 1.6 GB per data channel reach the queue by default ([application.conf#L40](https://github.com/apache/texera/blob/95e2748b97e0cdd29069971fe74349ac5f28134b/common/config/src/main/resources/application.conf#L40)). A prototype that reads only the sendable messages cut the ACK handling for a 10,000-message backlog from 73.6 ms to 1.2 ms. In a local Text Input → Count run with one row per batch and every data ACK held for 20 ms to imitate a network round trip, the queue reached about 12,000 messages and the median run time dropped 13% (738 ms to 640 ms). With normal local ACKs the queue sta yed nearly empty and run times did not change. Read and remove only the messages that fit in the window, and leave the rest queued in order. Sending order, the window, ACK handling and resends stay the same. ### Task Type - [ ] Refactor / Cleanup - [ ] DevOps / Deployment / CI - [ ] Testing / QA - [ ] Documentation - [x] Performance - [ ] Other -- 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]
