Message passing, performance–take 2
In my previous post, I did some rough “benchmarks” to see how message passing options behave. I got some great comments, and I thought I’ll expand on that.
The baseline for this was a blocking queue, and we managed to process using that we managed to get:
145,271,000 msgs in 00:00:10.4597977 for 13,888,510 ops/sec
And the async BufferBlock, using which we got:
43,268,149 msgs in 00:00:10 for 4,326,815 ops/sec.
Using LMAX Disruptor we got a disappointing:
29,791,996 msgs in 00:00:10.0003334 for 2,979,100 ops/sec
However, it was pointed out that I can significantly improve this if I changed the code to be:
var disruptor = new Disruptor.Dsl.Disruptor<Holder>(() => new Holder(), new SingleThreadedClaimStrategy(256), new YieldingWaitStrategy(), TaskScheduler.Default);
After which we get a very nice:
141,501,999 msgs in 00:00:10.0000051 for 14,150,193 ops/sec
170,726,000 msgs in 00:00:10.0000042 for 17,072,593 ops/sec