Class ExponentionallyIncreasingSleepingWaitStrategy
- java.lang.Object
-
- co.elastic.apm.agent.report.disruptor.ExponentionallyIncreasingSleepingWaitStrategy
-
- All Implemented Interfaces:
com.lmax.disruptor.WaitStrategy
public final class ExponentionallyIncreasingSleepingWaitStrategy extends java.lang.Object implements com.lmax.disruptor.WaitStrategySleeping strategy that sleeps (LockSupport.parkNanos(n)) for an linearly increasing number of nanos while theEventProcessors are waiting on a barrier.This strategy consumes very little CPU resources. However, latency spikes up to
sleepTimeNsMaxwill occur. It will also reduce the impact on the producing thread as it will not need signal any conditional variables to wake up the event handling thread.The agent does not require to transfer events with low latency from producers to the consumer. The primary concerns are low latency for adding events (to not block application threads) and low CPU consumption. It does not matter if handling the events is a bit delayed. The only caveat is that sudden traffic spikes after quiet periods can lead to loosing events. If that should become a problem, take a look at the approaches outlined in https://github.com/LMAX-Exchange/disruptor/issues/246 and https://github.com/census-instrumentation/opencensus-java/pull/1618. In situations where the consumer is overloaded (always busy and awake) this wait strategy actually has very good latency because consumers don't have to signal.
-
-
Constructor Summary
Constructors Constructor Description ExponentionallyIncreasingSleepingWaitStrategy(int sleepTimeNsStart, int sleepTimeNsMax)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsignalAllWhenBlocking()longwaitFor(long sequence, com.lmax.disruptor.Sequence cursor, com.lmax.disruptor.Sequence dependentSequence, com.lmax.disruptor.SequenceBarrier barrier)
-
-
-
Method Detail
-
waitFor
public long waitFor(long sequence, com.lmax.disruptor.Sequence cursor, com.lmax.disruptor.Sequence dependentSequence, com.lmax.disruptor.SequenceBarrier barrier) throws com.lmax.disruptor.AlertException- Specified by:
waitForin interfacecom.lmax.disruptor.WaitStrategy- Throws:
com.lmax.disruptor.AlertException
-
signalAllWhenBlocking
public void signalAllWhenBlocking()
- Specified by:
signalAllWhenBlockingin interfacecom.lmax.disruptor.WaitStrategy
-
-