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

   ### Motivation
   
   The topic loading time could be high with pressure, but it's hard to measure 
which sub-task takes the most time. This is a follow-up work of 
https://github.com/apache/pulsar/pull/24785 to improve the logs that show topic 
loading latency.
   
   ### Modifications
   
   Add a simple tracing class `LatencyTracer` and trace asynchronous futures 
during topic loading. When tracing a future, if the future is already done, 
skip tracing it because such tasks are usually not CPU-bounded.
   
   ### Verifying this change
   
   `LatencyTracerTest` covers functionality of all public methods with injected 
timestamps. The topic loading logs can be checked by running 
`testConcurrentLoadTopicExceedLimitShouldNotBeAutoCreated`:
   
   
   ```
   Loaded topic {dedupEnabled=false, latency=total: 115 ms, ml-config: 9 ms, 
open-ml: 58 ms, init: 46 ms, topic=persistent://prop/concurrentLoad/my-topic_0}
   Loaded topic {dedupEnabled=false, latency=total: 19 ms, open-ml: 17 ms, 
init: 1 ms, topic=persistent://prop/concurrentLoad/my-topic_1}
   Loaded topic {dedupEnabled=false, latency=total: 20 ms, open-ml: 18 ms, 
init: 1 ms, topic=persistent://prop/concurrentLoad/my-topic_2}
   Loaded topic {dedupEnabled=false, latency=total: 5 ms, properties: 3 ms, 
topic=persistent://prop/concurrentLoad/my-topic_0}
   Loaded topic {dedupEnabled=false, latency=total: 8 ms, queued: 3 ms, 
properties: 2 ms, topic=persistent://prop/concurrentLoad/my-topic_1}
   Loaded topic {dedupEnabled=false, latency=total: 12 ms, queued: 8 ms, 
properties: 3 ms, topic=persistent://prop/concurrentLoad/my-topic_2}
   ```
   
   ### Out of scope
   
   In my previous tests, opening managed ledger could also take much time, this 
`LatencyTracer` class can be used to track managed ledger open process as well.


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