RingBuffer has a fixed array allocation size. It needs a pre-set buffer size to initiate the needed allocation. It's recommended keep this size more than 11 (keeping in mind that bufferSize should be a power of 2), yet this depends on the hosting machine & on your architecture.
How to set disruptor's ClaimStrategy buffersize
-
02-12-2021 - |
문제
Now I am using disruptor,I get a simple example of consumer-productor.It runs perfect,But I don't know the meaning of buffersize,which size should I set to it?
private static final int BUFFER_SIZE = 4;
private final RingBuffer<StockEvent> ringBuffer =
new RingBuffer<StockEvent>(StockEvent.EVENT_FACTORY,
new MultiThreadedLowContentionClaimStrategy(BUFFER_SIZE),
new YieldingWaitStrategy());
private final SequenceBarrier sequenceBarrier = ringBuffer.newBarrier();
what's the meaning of BUFFER_SIZE?
해결책
제휴하지 않습니다 StackOverflow