[concurrency-interest] ConcurrentLinkedQueue vs. ConcurrentLinkedDeque

Christian Schudt christian.schudt at gmx.de
Fri Feb 26 07:58:24 EST 2016

I've had performance problems (high CPU) in my app and after research I suspected ConcurrentLinkedQueue to be a possible source (due to [1], [2]).
Although I am still not sure it's really the source for my problem, I discovered significant performance differences between ConcurrentLinkedQueue and ConcurrentLinkedDeque:
    public static void main(String[] args) {

        Queue<String> queue = new ConcurrentLinkedDeque<>();
        String a = "a";
        String b = "b";
        for (int i = 0; ; i++) {
            if (i % 1024 == 0) {
                System.out.println("i = " + i);

ConcurrentLinkedDeque is much faster! (Just replace it with ConcurrentLinkedQueue, the output becomes very slow)

Not sure, if this is related to JDK-8054446 [2] or if it's "normal".
Any comments?

Is there any reason to prefer ConcurrentLinkedQueue over ConcurrentLinkedDeque? 

(I am using JDK 8u60.)

Kind regards,

[1]: https://perfstories.wordpress.com/2012/08/01/why-does-cpu-utilization-happen-sometimes/
[2]: https://bugs.openjdk.java.net/browse/JDK-8054446

More information about the Concurrency-interest mailing list