Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2858

More flexible configuration of WaitStrategy of Disruptor

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.13.3
    • 2.14.0
    • Configuration
    • None

    Description

      I have realized that there is garbage generated from the following stack trace:

      AbstractQueuedSynchronizer$Node java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.addConditionWaiter() 
      long util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(long)
      long com.lmax.disruptor.TimeoutBlockingWaitStrategy.waitFor(long, Sequence, Sequence, SequenceBarrier)
      long com.lmax.disruptor.ProcessingSequenceBarrier.waitFor(long)
      void com.lmax.disruptor.BatchEventProcessor.processEvents()
      void com.lmax.disruptor.BatchEventProcessor.run()
      void java.lang.Thread.run()
      

      Thus, I would like to use some other wait strategy. However there are only few possibilities. I would prefer to use SleepingWaitStrategy with custom parameters. But there is no such option:

      case "SLEEP":
      return new SleepingWaitStrategy();
      case "YIELD":
      return new YieldingWaitStrategy();
      case "BLOCK":
      return new BlockingWaitStrategy();
      case "BUSYSPIN":
      return new BusySpinWaitStrategy();
      case "TIMEOUT":
      return new TimeoutBlockingWaitStrategy(timeoutMillis, TimeUnit.MILLISECONDS);
      default:
      return new TimeoutBlockingWaitStrategy(timeoutMillis, TimeUnit.MILLISECONDS);

       

      The key goal is to log messages with weak requirements on logging latency, BUT in the JVM with low-latency code.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              stepan2271 Stepan Gorban
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3.5h
                  3.5h