[concurrency-interest] ConcurrentLinkedQueue in Java 5 vs. 6

√iktor Ҡlang viktor.klang at gmail.com
Sat Apr 7 13:55:54 EDT 2012


On Sat, Apr 7, 2012 at 7:45 PM, Ilya Mirsky <ilya.mirsky at gmail.com> wrote:

> Hi,
>
> Running some benchmarks on a multicore machine (Ultra SPARC T2),
> I noticed a significant improvement in performance
> of ConcurrentLinkedQueue in Java 6 (1.6.0_23) over Java 5 (1.5.0_14).
>  The improvement in high contention scenarios is in a factor of up to 5
> times!
>
> I'm curious about the reason for this improvement, as the basic algorithm
> is the same (MS queue)...
> Examining both of the source files, I noticed that in Java 6 version
> there's a use in lazySet in some places,
> and direct usage of Unsafe class, instead of AtomicReferenceFieldUpdater
> in java 5.
>

My experience with AtomicReferenceFieldUpdater has been a sad one. Use
Unsafe + volatile field to avoid the cost of the runtime checks of the
updater and the false sharing issues with the AtomicReference/Integer etc.
The runtime costs of the Updaters get worse when there is contention since
the checks run on each retry.


>
> But could this explain the significant improvement, or are there other key
> chages?
>

I'll let the man himself answer that :-)

Cheers,
√


>
>
> Thanks in advance,
> ---
> Best Regards,
> Ilya Mirsky
> <http://www.cs.bgu.ac.il/~mirskyil/>  <http://il.linkedin.com/in/ilyamirsky>
>    <https://www.facebook.com/ilya.mirsky>
>
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>


-- 
Viktor Klang

Akka Tech Lead
Typesafe <http://www.typesafe.com/> - The software stack for applications
that scale

Twitter: @viktorklang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20120407/bb07b88a/attachment.html>


More information about the Concurrency-interest mailing list