If you are looking for a comparison in the real world, here is one. Our application has two (2) topics: 1) a read stream to capture a network packet, and 2) a consumer stream that receives a packet, counts it, and reports statistics.
Topic # 1 exchanges one packet at a time with thread # 2
Result # 1 - uses CAS-based user exchange using the same principles as SynchronousQueue, where our class is called CASSynchronousQueue:
30,766,538 packets in 59.999 seconds :: 500.763Kpps, 1.115Gbps 0 drops libpcap statistics: recv=61,251,128, drop=0(0.0%), ifdrop=0
Result # 2 - when replacing our CAS implementation with standard java SynchronousQueue:
8,782,647 packets in 59.999 seconds :: 142.950Kpps, 324.957Mbps 0 drops libpcap statistics: recv=69,955,666, drop=52,369,516(74.9%), ifdrop=0
I do not think that the difference in performance could not be more clear.
Mark Bednarczyk Jul 20 '15 at 3:12 2015-07-20 03:12
source share