[concurrency-interest] ConcurrentLinkedQueue in Java 5 vs. 6
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:
> 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
> 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
I'll let the man himself answer that :-)
> Thanks in advance,
> Best Regards,
> Ilya Mirsky
> <http://www.cs.bgu.ac.il/~mirskyil/> <http://il.linkedin.com/in/ilyamirsky>
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
Akka Tech Lead
Typesafe <http://www.typesafe.com/> - The software stack for applications
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest