Class VeniceAdaptiveBlobTransferTrafficThrottler
java.lang.Object
com.linkedin.davinci.blobtransfer.VeniceAdaptiveBlobTransferTrafficThrottler
- All Implemented Interfaces:
VeniceAdaptiveThrottler
public class VeniceAdaptiveBlobTransferTrafficThrottler
extends Object
implements VeniceAdaptiveThrottler
Adaptive throttling wrapper for
GlobalChannelTrafficShapingHandler
that dynamically tunes global read or write limits for blob transfer based on registered boolean signals.
It controls either global read or write throughput for the blob transfer behavior based on results of the registered
limiter and booster signals.
The heuristic behavior rules are defined as:
(1) If any limiter signal found, it will decrease by 20%. (min 20% of the base rate).
(2) If no limiter signal found, but there is booster signal found, it will increase by 20%. (max 200% of the base rate).
(3) If none of the above rule applies, it will increase idle count, if idle count is greater than the pre-defined
threshold, it will try to increase by 20% (still max 200% of the base rate).
Base rate is initially set to ConfigKeys.BLOB_TRANSFER_SERVICE_WRITE_LIMIT_BYTES_PER_SEC
or ConfigKeys.BLOB_TRANSFER_CLIENT_READ_LIMIT_BYTES_PER_SEC
and will be adjusted based on
input signals dynamically.-
Constructor Summary
ConstructorsConstructorDescriptionVeniceAdaptiveBlobTransferTrafficThrottler
(int singleIdleThreshold, long baseRate, int rateUpdatePercentage, boolean isWriteThrottler) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Evaluates all registered limiter and booster signals, and adjusts the throttler’s rate accordingly.long
Returns the current effective throttler rate after adaptive adjustments.Returns a human-readable name for this throttler instance.void
registerBoosterSignal
(BooleanSupplier supplier) Registers a booster signal supplier that, when evaluated totrue
, indicates that the throttler may safely increase its throughput rate.void
registerLimiterSignal
(BooleanSupplier supplier) Registers a limiter signal supplier that, when evaluated totrue
, indicates that the throttler should reduce its throughput rate.void
setGlobalChannelTrafficShapingHandler
(io.netty.handler.traffic.GlobalChannelTrafficShapingHandler globalChannelTrafficShapingHandler)
-
Constructor Details
-
VeniceAdaptiveBlobTransferTrafficThrottler
public VeniceAdaptiveBlobTransferTrafficThrottler(int singleIdleThreshold, long baseRate, int rateUpdatePercentage, boolean isWriteThrottler)
-
-
Method Details
-
registerLimiterSignal
Description copied from interface:VeniceAdaptiveThrottler
Registers a limiter signal supplier that, when evaluated totrue
, indicates that the throttler should reduce its throughput rate.- Specified by:
registerLimiterSignal
in interfaceVeniceAdaptiveThrottler
- Parameters:
supplier
- aBooleanSupplier
providing the limiter signal.
-
registerBoosterSignal
Description copied from interface:VeniceAdaptiveThrottler
Registers a booster signal supplier that, when evaluated totrue
, indicates that the throttler may safely increase its throughput rate.- Specified by:
registerBoosterSignal
in interfaceVeniceAdaptiveThrottler
- Parameters:
supplier
- aBooleanSupplier
providing the booster signal.
-
checkSignalAndAdjustThrottler
public void checkSignalAndAdjustThrottler()Description copied from interface:VeniceAdaptiveThrottler
Evaluates all registered limiter and booster signals, and adjusts the throttler’s rate accordingly. The exact adjustment strategy is defined by the implementation.- Specified by:
checkSignalAndAdjustThrottler
in interfaceVeniceAdaptiveThrottler
-
getCurrentThrottlerRate
public long getCurrentThrottlerRate()Description copied from interface:VeniceAdaptiveThrottler
Returns the current effective throttler rate after adaptive adjustments.- Specified by:
getCurrentThrottlerRate
in interfaceVeniceAdaptiveThrottler
- Returns:
- the current throttling rate, typically represented in operations per second or another unit defined by the implementation.
-
getThrottlerName
Description copied from interface:VeniceAdaptiveThrottler
Returns 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:
getThrottlerName
in interfaceVeniceAdaptiveThrottler
- Returns:
- the throttler’s name.
-
setGlobalChannelTrafficShapingHandler
public void setGlobalChannelTrafficShapingHandler(io.netty.handler.traffic.GlobalChannelTrafficShapingHandler globalChannelTrafficShapingHandler)
-