0

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?

Slugart
  • 4,535
  • 24
  • 32
  • Perhaps the event handlers are blocked or that they cannot keep up with the producer threads. Could you add more details to your question. – Slugart Feb 26 '21 at 12:30

1 Answers1

1

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.

Slugart
  • 4,535
  • 24
  • 32
  • thank you, Slugart, we use mokito to mock one of the processors, can the mock reduce the processing speed? Future future = new MockProducerSendResult(record); result = future.get();, the MockProducerSendResult creates only processed metadata record. – Эльфия Валиева Feb 28 '21 at 16:30
  • I don't have any experience with mokito. I would try removing it and replacing by your own event handler which does not perform any processing to isolate the issue. You can also debug at the point at which the ring buffer becomes full to inspect each of the event handler sequences to determine which one is not advancing. – Slugart Mar 01 '21 at 10:20