
JDK LinkedBlockingQueue VS Amino LockFreeBlockQueue
Posted by andy.song in Twins Father on Nov 18, 2010 4:06:32 AM[Introduction]
Recently we have done one scale backend messaging processing system. Underlying the thread/concurrent design need one Queue implementation. And I found one interest replacement one "Amino Project" "LockFreeBlockQueue". It mentioned this implementation outperformed than jdk "ConcurrentLinkedQueue".http://www.infoq.com/articles/scalable-java-components. So I think maybe it will help us improve the whole system performance. And this project was based one IBM jdk, so I migrated it to SUN jdk.
[Lab Environment]
Laptop: Dell E6410
CPU: Intel i5 (with 4 core)
Memory: 4G DDR3
JDK: Sun JDK 1.6 u18
//Edit: Forget add OS information
OS: windows XP sp3
[Testing Senario]
start 16 threads currently write string (UUID), each thread will write 200 numbers of string,into the underlying single queue instance, and at them same time start 16 threads concurrently reading the string, each thread will read 200 numbers of string,has been inserted from the same underlying single queue instance.
I have tested 5 rounds:
Version | Round1 Get | Round2 Get | Round3 Get | Round4 Get | Round5 Get | ||||
---|---|---|---|---|---|---|---|---|---|
LinkedBlockingQueue(JDK) | Max: 97384444 Min: 1117 Avg: 249965.7841 |
|
|
|
| ||||
LockFreeBlockQueue(Amnio) | Max:94351097 Min:1396 Avg:233762.4281 |
|
|
|
|
Note: All the results was NanoSeconds. Only calculate the read operations rather than write operations. Later will add the write operation statistics.
[Summary]
Doug Lea had done pretty jobs on the LinkedBlockingQueue, it's performance was stable and could meet most kinds of situation even in high concurrent situations.
Amino project wasn't so bad from the performance testing. But it cannot tell have outporformed than the Sun JDK implementation. But I didn't test on the IBM jdk env, maybe the situation will be changed.
And one important change had already made into LinkedBlockingQueue but still not includes with latest JDK 1.6 library.
http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/concurrent/LinkedBlockingQueue.java?view=log reversion 1.54
move value allocation outside the lock scope.
Later we will testing the latest version of Doug lea
[Reference]
1. Doug Lea : http://gee.cs.oswego.edu/dl/concurrency-interest/
2. Amino Project: http://sourceforge.net/projects/amino-cbbs/files/cbbs/1.0/amino-java-src-1.0.tar.gz/download?use_mirror=jaist
-
LinkedBlockingQueueTester.java.zip 791 bytes
-
LockFreeBlockingQueueTester.java.zip 795 bytes
Comments