I see they're using spin locks in Conversant Disruptor: <
https://github.com/conversant/disruptor/blob/master/src/main/java/com/conversantmedia/util/concurrent/AbstractSpinningCondition.java>.
I'd imagine something similar is in JCTools and LMAX, so it would be useful
to request support for this upstream.

>From what I can tell, LinkedTransferQueue in JDK9 doesn't rely on spin
locks as it's using an interesting algorithm whose documentation is
literally half the source file. I see that they've updated it to use
VarHandles instead of Unsafe, though, so there's that, too.

On 18 December 2016 at 06:43, Remko Popma <remko.po...@gmail.com> wrote:

>
>
>
> Sent from my iPhone
> On 18 Dec 2016, at 13:05, Remko Popma <remko.po...@gmail.com> wrote:
>
> I don't think we use spin locks in production code anywhere.
>
> The latency test has a wait strategy interface and one of the
> implementations is spinning. I need to check the comments but not sure if I
> used that strategy for the latency tests for the garbage free performance
> page.
>
>
> I just noticed that Gil Tene authored JEP 285. He is also the author of
> the Pacer class used in our latency test (https://github.com/apache/
> logging-log4j2/blob/master/log4j-core/src/test/java/org/
> apache/logging/log4j/core/async/perftest/ResponseTimeTest.java)
>
> Our test checks the number of cores, and if sufficient, it uses the 
> NoOpIdleStrategy
> (spin wait). The alternative is yielding the thread, but who knows when the
> thread gets scheduled again (and on which core - a different core means the
> cache is cold). For latency measurements of short duration, the hope is
> that a spinning wait introduces less noise.
>
>
>
> Sent from my iPhone
>
> On 18 Dec 2016, at 10:10, Matt Sicker <boa...@gmail.com> wrote:
>
> I thought we were using it in AppenderControlArraySet for example, but it
> doesn't look like it really matches the idea. I've been reading through all
> the JEPs in JDK9 to see if there's anything else useful we haven't already
> marked in our epic <https://issues.apache.org/jira/browse/LOG4J2-1564>,
> and I found Thread.onSpinWait() <http://openjdk.java.net/jeps/285> which
> looked useful, but I'm not sure of anywhere we could use it.
>
> --
> Matt Sicker <boa...@gmail.com>
>
>


-- 
Matt Sicker <boa...@gmail.com>

Reply via email to