shibd opened a new pull request, #23072:
URL: https://github.com/apache/pulsar/pull/23072

   ### Motivation
   If a subscription has many consumers and each consumer individually 
acknowledges messages from other consumers, this scenario is very CPU 
resource-intensive.
   
   Refer this:
   <img width="2403" alt="image" 
src="https://github.com/user-attachments/assets/13ae45da-daa2-4f44-a8c9-820dac6a7344";>
   
   
   In fact, these three methods achieve the same goal: `obtaining the message 
ID from the owning consumer object`
   This operation is very CPU resource-intensive
   
   **getAckOwnerConsumer**:
   
https://github.com/apache/pulsar/blob/d7e8ea16e6682df9a9354cda25cf4f1f9cb54429/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java#L735-L748
   
   **getBatchSize**:
   
https://github.com/apache/pulsar/blob/d7e8ea16e6682df9a9354cda25cf4f1f9cb54429/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java#L657
   
   **removePendingAcks**:
   
https://github.com/apache/pulsar/blob/d7e8ea16e6682df9a9354cda25cf4f1f9cb54429/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java#L1024-L1034
   
   This PR will make sure to call one time : `getAckOwnerConsumer` 
   
   
   ### Modifications
   
   This PR ensures that the `getAckOwnerConsumer` method is called only once 
during the processing of a message ack. In the future, we may need to optimize 
this method further.
   
   After this PR:
   <img width="2139" alt="image" 
src="https://github.com/user-attachments/assets/61512c53-bde9-4e69-a05b-02974714d76d";>
   
   Test Code: 
   
   
   ### Verifying this change
   All tests passed to make sure not have any break change.
   
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   


-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to