[ 
https://issues.apache.org/jira/browse/LOG4J2-1892?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15996786#comment-15996786
 ] 

Matt Sicker commented on LOG4J2-1892:
-------------------------------------

https://github.com/conversant/disruptor/blob/master/src/main/java/com/conversantmedia/util/concurrent/SpinPolicy.java

It looks like that may be expected as it's a policy that doesn't use normal 
blocking and is handy for a small number of threads. In general, low latency 
spin policies tend to use lots of CPU as they loop, waiting for input as soon 
as it's available.

> High constant CPU usage with Async appender DisruptorBlockingQueue spinPolicy 
> 'WAITING'
> ---------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-1892
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1892
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.8.2
>         Environment: OSX 10.11 JDK 7 Jetty 9.2 
> but also observed in Docker container JDK 8/Tomcat 8
>            Reporter: Daniel R
>              Labels: performance
>         Attachments: with spinPolicy BLOCKING.png, with spinPolicy WAITING.png
>
>
> With {{spinPolicy="WAITING"}} CPU usage shoots up to 11% and stays right 
> there with no app activity.
> With {{spinPolicy="BLOCKING"}} CPU usage goes down to near 0% with no app 
> usage.
> See screenshots attached.
> In my local dev environment the Async appender is configured but not used 
> (commented out in the <Root> section.
> {{log4j2.xml}} config excerpt:
> {code:xml}
> <Appenders>
>       ...
> <!-- Wrap the email error appender into an asynchronous appender -->
> <Async name="ASYNC_EMAIL_ERROR" bufferSize="128" >
>       <DisruptorBlockingQueue spinPolicy="WAITING"/>
>       <AppenderRef ref="EMAIL_ERROR" />
> </Async>
> </Appenders>
> <Root level="INFO">
>       <AppenderRef ref="CONSOLE"/>
>       <!--AppenderRef ref="FILE"/-->
>       <!--AppenderRef ref="FILE_ERROR"/-->
>       <!--AppenderRef ref="ASYNC_EMAIL_ERROR"/-->
> </Root>
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to