[Java] Support batch acknowledgements for PushConsumer - #1326
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1326 +/- ##
============================================
+ Coverage 53.26% 63.24% +9.97%
- Complexity 651 856 +205
============================================
Files 208 109 -99
Lines 14303 4807 -9496
Branches 5845 390 -5455
============================================
- Hits 7619 3040 -4579
+ Misses 6308 1558 -4750
+ Partials 376 209 -167
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Introduces AckMessageBatcher to batch PushConsumer acknowledgements by (endpoints, topic), reducing per-message RPC overhead. The design is clean: batches are flushed either when the size threshold is reached or when a delay timer expires. Partial failures (MULTIPLE_RESULTS) are correctly mapped back to individual message futures, and missing results default to INTERNAL_ERROR so the caller can retry. FIFO and lite-consumer messages correctly bypass batching to preserve ordering guarantees.
The retry path (ackMessageLater) correctly forces batchable=false to prevent re-batching of failed messages, and flushAndClose() provides a graceful shutdown mechanism.
Comprehensive test coverage (7 test cases) validates the key scenarios.
LGTM.
Automated review by github-manager
Which Issue(s) This PR Fixes
Fixes #1325
Brief Description
The Java gRPC PushConsumer currently sends one acknowledgement RPC for every successfully consumed message even though
AckMessageRequestsupports repeated entries. Under a high consume rate, these one-entry requests add substantial client and Proxy overhead.This change introduces one acknowledgement batcher per PushConsumer:
The current RocketMQ Proxy protocol and batch-ACK path already accept repeated entries, so this change does not require a protocol update.
At approximately 8,000 TPS in the medium 2B workload, two controlled candidate runs averaged about 20.4 entries per ACK RPC, reducing ACK RPC volume by approximately 95.1%. Total Java consumer CPU decreased by approximately 20.6%, while throughput remained unchanged. A separate single-topic validation observed requests with exactly 1,024 entries.
How Did You Test This Change?
zsh -ic 'javaswitch 11 >/dev/null && mvn -f java/pom.xml -pl client -am test'major version: 52).