TakaHiR07 opened a new issue, #19169:
URL: https://github.com/apache/pulsar/issues/19169

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### Version
   
   server and client version: pulsar-2.9.4
   
   
   ### Minimal reproduce step
   
   do txn produce and txn consume on a 200-partition topic by pulsar-perf. The 
throughput is 10MB/s, batchSize is 10, subscriptionType is exclusive. It is a 
tailing read, consuming the latest message
   produce config is :`-txn -nmt 1000 -time 0 -s 1024 -i 60 -bm 10 -b 1000 -bb 
4194304 -r 10000 -mk random -threads 3`; consume config is : `-txn -nmt 2000 
-time 0 -i 60 -s sub_test_txn_p200 -ss sub_test_txn_p200  -sp Latest -ioThreads 
1 -n 1`
   
   
   ### What did you expect to see?
   
   The cpu usage should not be so high when it is exclusive subscription, 
tailing read and txn consume. 
   
   Actually the tailing read should not consume more resource than catchup read.
   
   
   
   ### What did you see instead?
   
   1. when it is tailing read and exclusive subscription and txn consume, the 
cpu usage is 80%. But when it turn to catchup read, the cpu usage is 45%. 
   
![企业微信截图_68d2681c-381c-4e4e-bf77-22a8560160b3](https://user-images.githubusercontent.com/13505225/211499987-b2999e11-ec5c-4401-ac67-731d688b75d6.png)
   
   2. Throughput would not influence the cpu usage, but if topic have more 
partition, the cpu usage is higher.
   
   I add some log in code and have found the cpu is consumed in 
"broker-topic-workers", which is mostly do 
PersistentDispatcherSingleActiveConsumer#readEntriesComplete and 
PersistentDispatcherSingleActiveConsumer#dispatchEntriesToConsumer.
   
   
![wecom-temp-b401a17cdc200f2ae0bcaae843b8e908](https://user-images.githubusercontent.com/13505225/211498614-00db713e-ca3b-4ace-ba71-91341571db51.png)
   
   I also add a metric of thread pool "broker-topic-workers", and found that 
when do catchup read 
   
   
   2. Throughput would not influence the cpu usage, but if topic have more 
partition, the cpu usage is higher.
   
   
   3. I add some log in code and have found the cpu is consumed in 
"broker-topic-workers", which is mostly do 
PersistentDispatcherSingleActiveConsumer#readEntriesComplete and 
PersistentDispatcherSingleActiveConsumer#dispatchEntriesToConsumer.
   
   
![wecom-temp-b401a17cdc200f2ae0bcaae843b8e908](https://user-images.githubusercontent.com/13505225/211498614-00db713e-ca3b-4ace-ba71-91341571db51.png)
   
   4. I also add a metric of thread pool "broker-topic-workers", and found that 
when do catchup read. the completed task in thread pool is total 150K * 8 
thread = 1200K/s, while the read throughput is 10K message/s. There are too 
many task in this thread pool.
   
   
![企业微信截图_39976729-a720-46d5-8bdd-36c0a098f484](https://user-images.githubusercontent.com/13505225/211500513-a8c591b9-2d5a-4839-9d24-e20fdd55b268.png)
   
   
![企业微信截图_082e1928-525e-4ef8-bc33-19bb7eb4e8e5](https://user-images.githubusercontent.com/13505225/211501046-fb5334f2-c193-41d0-ab7b-b8cd60f26cba.png)
   
   
   ### Anything else?
   
   Although tested in 2.9.4, I guess this problem may also occur in master 
branch.
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


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