Class VeniceAdaptiveIngestionThrottler
java.lang.Object
com.linkedin.venice.throttle.EventThrottler
com.linkedin.davinci.kafka.consumer.VeniceAdaptiveIngestionThrottler
- All Implemented Interfaces:
VeniceAdaptiveThrottler,VeniceRateLimiter
public class VeniceAdaptiveIngestionThrottler
extends EventThrottler
implements VeniceAdaptiveThrottler
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.linkedin.venice.throttle.VeniceRateLimiter
VeniceRateLimiter.RateLimiterType -
Field Summary
Fields inherited from class com.linkedin.venice.throttle.EventThrottler
BLOCK_STRATEGY, REJECT_STRATEGY -
Constructor Summary
ConstructorsConstructorDescriptionVeniceAdaptiveIngestionThrottler(int signalIdleThreshold, long quotaPerSecond, List<Double> factors, long timeWindow, String throttlerName, AdaptiveThrottlingServiceStats adaptiveThrottlingServiceStats) -
Method Summary
Modifier and TypeMethodDescriptionvoidEvaluates all registered limiter and booster signals, and adjusts the throttler’s rate accordingly.longReturns the current effective throttler rate after adaptive adjustments.Returns a human-readable name for this throttler instance.voidmaybeThrottle(double eventsSeen) Sleeps if necessary to slow down the caller.voidregisterBoosterSignal(BooleanSupplier supplier) Registers a booster signal supplier that, when evaluated totrue, indicates that the throttler may safely increase its throughput rate.voidregisterLimiterSignal(BooleanSupplier supplier) Registers a limiter signal supplier that, when evaluated totrue, indicates that the throttler should reduce its throughput rate.Methods inherited from class com.linkedin.venice.throttle.EventThrottler
getConfiguredMaxRatePerSecond, getMaxRatePerSecond, getQuota, getRateConfig, getTime, isCheckQuotaBeforeRecording, setQuota, toString, tryAcquirePermit
-
Constructor Details
-
VeniceAdaptiveIngestionThrottler
public VeniceAdaptiveIngestionThrottler(int signalIdleThreshold, long quotaPerSecond, List<Double> factors, long timeWindow, String throttlerName, AdaptiveThrottlingServiceStats adaptiveThrottlingServiceStats)
-
-
Method Details
-
getThrottlerName
Description copied from interface:VeniceAdaptiveThrottlerReturns a human-readable name for this throttler instance.This is useful for logging, debugging, or monitoring purposes when multiple throttlers are in use.
- Specified by:
getThrottlerNamein interfaceVeniceAdaptiveThrottler- Overrides:
getThrottlerNamein classEventThrottler- Returns:
- the throttler’s name.
-
maybeThrottle
public void maybeThrottle(double eventsSeen) Description copied from class:EventThrottlerSleeps if necessary to slow down the caller.- Overrides:
maybeThrottlein classEventThrottler- Parameters:
eventsSeen- Number of events seen since last invocation. Basis for determining whether its necessary to sleep.
-
registerLimiterSignal
Description copied from interface:VeniceAdaptiveThrottlerRegisters a limiter signal supplier that, when evaluated totrue, indicates that the throttler should reduce its throughput rate.- Specified by:
registerLimiterSignalin interfaceVeniceAdaptiveThrottler- Parameters:
supplier- aBooleanSupplierproviding the limiter signal.
-
registerBoosterSignal
Description copied from interface:VeniceAdaptiveThrottlerRegisters a booster signal supplier that, when evaluated totrue, indicates that the throttler may safely increase its throughput rate.- Specified by:
registerBoosterSignalin interfaceVeniceAdaptiveThrottler- Parameters:
supplier- aBooleanSupplierproviding the booster signal.
-
checkSignalAndAdjustThrottler
public void checkSignalAndAdjustThrottler()Description copied from interface:VeniceAdaptiveThrottlerEvaluates all registered limiter and booster signals, and adjusts the throttler’s rate accordingly. The exact adjustment strategy is defined by the implementation.- Specified by:
checkSignalAndAdjustThrottlerin interfaceVeniceAdaptiveThrottler
-
getCurrentThrottlerRate
public long getCurrentThrottlerRate()Description copied from interface:VeniceAdaptiveThrottlerReturns the current effective throttler rate after adaptive adjustments.- Specified by:
getCurrentThrottlerRatein interfaceVeniceAdaptiveThrottler- Returns:
- the current throttling rate, typically represented in operations per second or another unit defined by the implementation.
-