LMAX Disruptor remainingCapacity equals 0, even before some time waiting

180 Views Asked by At

I added data to Disruptor by calling tryPublishEvent function. After I wait 40 second and tried to check unprocessedDataCount by following calculation:

long ringBufferUnProcessedCount = disruptor.getBufferSize() 
                                  - disruptor.getRingBuffer().remainingCapacity()

Sometimes remainingCapacity value equals to 0, even if before getting ringBufferUnProcessedCount value we wait 40 seconds. This error happens very rarely.

Do not you know why it might be?

1

There are 1 best solutions below

2
On

If disruptor.getRingBuffer().remainingCapacity() equals 0 then that means that your disruptor is full and you are experiencing backpressure.

This may be caused by two things, either one of the eventHandlers is blocked for whatever reason and cannot make forward progress or the eventHandlers cannot process events quickly enough to keep up with the rate of production of new events.