Easy performance montoring of your disruptor ringbuffers.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



Easy performance montoring of your disruptor ringbuffers.

It will:

  • Tell you how many items has been processed.
  • Min, max and average time (milliseconds) each item spent in the queue.
  • How much (percentage) of your ringbuffer is available.
  • Dump this data in your favorite logging framework via sinks (yes I stole the sink concept from serilog).

It will have a small impact on the overall performance of your ringbuffer. You need to choose carefully how you use it - If you log too much too often you will ruin performance. Play around with the settings to find your sweet spot.

Also available on nuget


Usage - 3 easy steps

This example will output metrics every second to the console.

What ever you put in your ringbuffer, make it implement IRingBufferItem.

public class QueueItem : IRingBufferItem
        public DateTimeOffset FirstTouchTime { get; set; }
        // All your other stuff here
        public void Update(QueueItem other)

When you enqueue a new item, set FirstTouchTime to UtcNow

  public void Enqueue(QueueItem item)
            var next = ringBuffer.Next();
            var entry = ringBuffer[next];
            entry.FirstTouchTime = DateTimeOffset.UtcNow;

Add the metrics eventhandler to your disruptor.

    var metricsEventHandler = new FixedSecondCountReporter<QueueItem>(new ColoredConsoleSink(), 1);    
    disruptor = Disruptor<QueueItem>(() => new QueueItem(), ringbufferSize, TaskScheduler.Default);

    disruptor.HandleEventsWith(eventHandler1, eventHandler2).Then(metricsEventHandler);
    ringBuffer = disruptor.Start();
    metricsEventHandler.Setup(ringBuffer); // Important: Do this AFTER disruptor.Start() has been run.

#License See the LICENSE file for license rights and limitations (MIT).