leizhiyuan opened a new pull request, #1461:
URL: https://github.com/apache/rocketmq-clients/pull/1461

   ### Which Issue(s) This PR Fixes
   
   Fixes #1458
   
   ### Brief Description
   
   The FIFO consume accelerator grouped the messages of a batch by message 
group. A lite message has no message group, so all lite messages of a batch 
fell into one group and `LitePushConsumer` consumed them one by one even with 
the accelerator on.
   
   - The group key is now the lite topic of a lite message, and the message 
group otherwise (`message.lite_topic().or(message.message_group())`). Normal 
FIFO messages are grouped exactly as before.
   - Different lite topics of a batch are consumed in parallel; the order 
inside each lite topic is kept.
   - Doc of `set_enable_fifo_consume_accelerator` mentions the lite topic.
   
   Reference Java: `LiteFifoConsumeService#getMessageGroupKey` returns 
`messageView.getLiteTopic()`.
   
   #### Notes for reviewers
   
   - One-line change in `consume_with_accelerator`; the rest is the test.
   - Merges with #1452, #1453, #1454 cleanly. With #1455, #1456 and #1457 the 
conflict is only in the test module (tests added at the same place); no 
production code overlaps. I will rebase whichever lands second.
   
   ### How Did You Test This Change?
   
   **Unit test**, fails on `master`:
   
   - `test_fifo_consume_accelerator_groups_lite_messages_by_lite_topic`: one 
batch of 4 lite topics × 3 messages, interleaved like the server returns them; 
the listener takes 100 ms. Every lite topic must be consumed in order, and the 
batch must take < 500 ms (`master`: 1,202 ms, i.e. 12 × 100 ms sequential).
   
   **End-to-end benchmark** (test environment in #1458 and #1445: mock proxy 
over real gRPC, release build, 3 runs, median):
   
   | `LitePushConsumer`, FIFO, 100 lite topics on 1 queue, listener 1 ms, RTT 2 
ms | `master` | this PR |
   |---|---|---|
   | accelerator on: consumed msg/s | 224.7 | **1,955.2** (8.7×) |
   | accelerator off: consumed msg/s | 224.3 | 223.4 (unchanged) |
   
   ```
   $ cargo test                                                   # lib: 151 
passed, 0 failed (master: 150)
   $ cargo clippy --all-features -- -D warnings                   # clean
   $ cargo fmt --check                                            # clean
   $ RUSTDOCFLAGS='--cfg docsrs' cargo doc --no-deps --all-features   # ok
   $ cargo build --examples --all-features                        # ok
   $ cargo +1.74.0 check --all-features --tests --examples        # ok (MSRV)
   ```
   
   ---
   
   Part of #1445 (Rust performance tracking).
   


-- 
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]

Reply via email to