You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Remko Popma (Jira)" <ji...@apache.org> on 2022/04/26 09:32:00 UTC

[jira] [Closed] (LOG4J2-3473) Provide garbage-free default disruptor WaitStrategy

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

Remko Popma closed LOG4J2-3473.
-------------------------------

> Provide garbage-free default disruptor WaitStrategy
> ---------------------------------------------------
>
>                 Key: LOG4J2-3473
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3473
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: Core
>    Affects Versions: 2.17.2
>            Reporter: Remko Popma
>            Assignee: Remko Popma
>            Priority: Major
>             Fix For: 2.17.3
>
>
> The default disruptor WaitStrategy used for Async Logging (com.lmax.disruptor.TimeoutBlockingWaitStrategy) is not garbage-free, because its implementation uses a {{{}java.util.concurrent.locks.ReentrantLock{}}}, which internally allocates many {{AbstractQueuedSynchronizer$Node}} objects.
> This was fixed in [https://github.com/LMAX-Exchange/disruptor/issues/227], where the ReentrantLock was replaced by a synchronized block, but this change is not included in the current production version 3.4.4 of LMAX Disruptor.
> (LMAX Disruptor 4.0.0.RC1 does include [this fix|https://github.com/LMAX-Exchange/disruptor/issues/227], but that version of the Disruptor requires Java 11 (in addition to some other incompatible changes), so upgrading to Disruptor 4.0.0 will not be a solution for this ticket - at least not for Java 8 users.)
> h4. Proposal:
> I propose to introduce a new class {{org.apache.logging.log4j.core.async.TimeoutBlockingWaitStrategy}} that is a copy of the latest version of the disruptor's [TimeoutBlockingWaitStrategy.java|https://github.com/LMAX-Exchange/disruptor/blob/master/src/main/java/com/lmax/disruptor/TimeoutBlockingWaitStrategy.java]. 
> This would be the default WaitStrategy used by Log4j.
> The only different between this and the current default WaitStrategy is that the new implementation uses a synchronized block instead of a ReentrantLock, so no temporary objects are allocated, making this WaitStrategy garbage-free.
> This is the commit in the LMAX disruptor repo that has the change we are trying to introduce:
> https://github.com/LMAX-Exchange/disruptor/commit/a18f8198ab94590f0a5ec7c3378ba87f997ea670



--
This message was sent by Atlassian Jira
(v8.20.7#820007)