LMAX Disruptor remainingCapacity equals 0, even before some time waiting

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?

Upvotes: 0

Views: 274

Answers (1)

Slugart
Slugart

Reputation: 4680

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.

Upvotes: 1

Related Questions