Technoboy- opened a new pull request, #15354:
URL: https://github.com/apache/pulsar/pull/15354

   ### Motivation
   Sometimes the messages sent to consumers are delayed over 100ms and we find 
that the CPU is wasted on :
   ```
   "BookKeeperClientWorker-OrderedExecutor-4-0" #64 prio=5 os_prio=0 
cpu=12748552.31ms elapsed=42037.79s tid=0x00007f7b4dc05720 nid=0xaf runnable  
[0x00007f7a376f4000]
      java.lang.Thread.State: RUNNABLE
        at 
org.apache.pulsar.common.util.collections.ConcurrentLongPairSet.forEach(ConcurrentLongPairSet.java:157)
        at 
org.apache.pulsar.common.util.collections.ConcurrentSortedLongPairSet.items(ConcurrentSortedLongPairSet.java:136)
        at 
org.apache.pulsar.common.util.collections.ConcurrentSortedLongPairSet.items(ConcurrentSortedLongPairSet.java:128)
        at 
org.apache.pulsar.common.util.collections.ConcurrentSortedLongPairSet.items(ConcurrentSortedLongPairSet.java:113)
        at 
org.apache.pulsar.broker.service.persistent.MessageRedeliveryController.getMessagesToReplayNow(MessageRedeliveryController.java:109)
        at 
   ```
   
   Then we find there are many empty datas in the map from dump :
   <img width="1129" alt="image" 
src="https://user-images.githubusercontent.com/6297296/165530721-e2da535f-f2a7-4d13-839f-f7bf157a1b5d.png";>
   
   ConcurrentSortedLongPairSet implements based on `ConcurrentLongPairSet`, and 
`ConcurrentLongPairSet` supports shrink, so support shrink for 
ConcurrentSortedLongPairSet to avoid iterator the empty data.
   
   ### Documentation
   
     
   - [x] `no-need-doc` 
   (Please explain why)
   


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