[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-4952?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kezhu Wang resolved ZOOKEEPER-4952.
-----------------------------------
    Fix Version/s: 3.10.0
         Assignee: Li Wang
       Resolution: Fixed

> Reduce the GC overhead of Prometheus reject exception handling
> --------------------------------------------------------------
>
>                 Key: ZOOKEEPER-4952
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4952
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: metric system
>    Affects Versions: 3.8.0, 3.9.0, 3.8.2, 3.8.3, 3.9.1, 3.8.4, 3.9.2, 3.9.3
>            Reporter: Li Wang
>            Assignee: Li Wang
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 3.10.0
>
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> As part of ZOOKEEPER-4289,  Prometheus summary reporting is handled as an 
> async operation using ThreadPoolExecutor.
> The default RejectedExecutionHandler used by ThreadPoolExecutor is 
> AbortPolicy, which performs toString() on both the Runnable object and 
> exception object. This can significantly impact performance when too many 
> exceptions occur after the max queue size exceeds.
> {code:java}
> public static class AbortPolicy implements RejectedExecutionHandler {
>         /**
>          * Creates an {@code AbortPolicy}.
>          */
>         public AbortPolicy() { }
>         /**
>          * Always throws RejectedExecutionException.
>          *
>          * @param r the runnable task requested to be executed
>          * @param e the executor attempting to execute this task
>          * @throws RejectedExecutionException always
>          */
>         public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
>             throw new RejectedExecutionException("Task " + r.toString() +
>                                                  " rejected from " +
>                                                  e.toString());
>         }
>     }
> {code}
> We can reduce the GC overhead and improve performance by implementing a 
> PrometheusRejectExceptionHandler and overriding the rejectedExecution() API.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to