lhotari opened a new pull request #10065:
URL: https://github.com/apache/pulsar/pull/10065


   ### Motivation
   
   In profiling, there can be seen an inefficiency in handling timeouts for 
CompletableFutures. For example, when creating topics, this can be seen in the 
flamegraph:
   
   
![image](https://user-images.githubusercontent.com/66864/112792205-accdc900-906b-11eb-9fa3-2236f90c9420.png)
   
   The root cause of this particular performance issue is that the exceptions 
are created eagerly.
   
   ### Modifications
   
   * Add methods to FutureUtils for adding timeout handling to existing futures 
and creating futures with timeout handling
   * Add a performance optimized subclass for TimeoutException that can be 
created by a factory method in FutureUtils
     * The exception doesn't create a stack trace because of performance 
reasons. Instead, the caller class and method name are provided when creating 
the exception.
     * The instances of this class are immutable and can be reused to minimize 
allocations.
   * Refactor existing code to use FutureUtils for adding timeout handling to 
futures.


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to