Class DynamicLoadFactor

java.lang.Object
io.confluent.parallelconsumer.internal.DynamicLoadFactor

public class DynamicLoadFactor extends Object
Controls a loading factor. Is used to ensure enough messages in multiples of our target concurrency are queued ready for processing.

Ensures that increases in loading factor aren't performed a) too soon after the last increase (isNotCoolingDown()) and b) too soon after starting the system (isWarmUpPeriodOver()).

  • Constructor Details

    • DynamicLoadFactor

      public DynamicLoadFactor()
  • Method Details

    • maybeStepUp

      public boolean maybeStepUp()
      Try to increase the loading factor
      Returns:
      true if could step up
    • isWarmUpPeriodOver

      public boolean isWarmUpPeriodOver()
      Is the warm-up period over?
      Returns:
      true if warn up os over
      See Also:
      • warmUp
    • isMaxReached

      public boolean isMaxReached()
    • getMaxFactor

      public int getMaxFactor()
      Upper safety cap on multiples of target queue size to reach (e.g. with 20 threads, this would be 20 * 100 = 20,000 messages _queued_.

      Expectation is some relatively small multiple of the degree of concurrency, enough that each time a thread finishes, theres at least one more entry for it in the queue.

    • getCurrentFactor

      public int getCurrentFactor()