Package io.confluent.parallelconsumer
Class DynamicLoadFactor
java.lang.Object
io.confluent.parallelconsumer.DynamicLoadFactor
public class DynamicLoadFactor
extends java.lang.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 (isNoCoolDown()) and b) too soon after starting the system (isWarmUpPeriodOver()).
-
Constructor Summary
Constructors Constructor Description DynamicLoadFactor() -
Method Summary
Modifier and Type Method Description intgetCurrentFactor()intgetMaxFactor()Upper safety cap on multiples of target queue size to reach (e.g.booleanisMaxReached()booleanmaybeStepUp()Try to increase the loading factor
-
Constructor Details
-
DynamicLoadFactor
public DynamicLoadFactor()
-
-
Method Details
-
maybeStepUp
public boolean maybeStepUp()Try to increase the loading factor- Returns:
- true if could step up
-
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()
-