Class CongestionControlRateLimitingStrategy
java.lang.Object
org.apache.flink.connector.base.sink.writer.strategy.CongestionControlRateLimitingStrategy
- All Implemented Interfaces:
RateLimitingStrategy
@PublicEvolving
public class CongestionControlRateLimitingStrategy
extends Object
implements RateLimitingStrategy
A
RateLimitingStrategy implementation that does the following:
- Scales up when any request is successful.
- Scales down when any message in a request is unsuccessful.
- Uses a scaling strategy to scale up/down depending on whether the request is successful.
This strategy works well for throughput-limited record-based sinks (e.g. Kinesis, Kafka).
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuilder()intReturns the current max batch size that RateLimitingStrategy will allow through.voidregisterCompletedRequest(ResultInfo resultInfo) Registers the result of completed requests (e.g. to track the current inFlightMessages / requests).voidregisterInFlightRequest(RequestInfo requestInfo) Registers the information of requests being sent (e.g. to track the current inFlightMessages / requests).booleanshouldBlock(RequestInfo requestInfo) Decides whether the next request should be blocked.
-
Method Details
-
registerInFlightRequest
Description copied from interface:RateLimitingStrategyRegisters the information of requests being sent (e.g. to track the current inFlightMessages / requests).- Specified by:
registerInFlightRequestin interfaceRateLimitingStrategy- Parameters:
requestInfo- Data class containing information on request being sent
-
registerCompletedRequest
Description copied from interface:RateLimitingStrategyRegisters the result of completed requests (e.g. to track the current inFlightMessages / requests). Any dynamic scaling on failed messages should be done here.- Specified by:
registerCompletedRequestin interfaceRateLimitingStrategy- Parameters:
resultInfo- Data class containing information on request completed
-
shouldBlock
Description copied from interface:RateLimitingStrategyDecides whether the next request should be blocked.- Specified by:
shouldBlockin interfaceRateLimitingStrategy- Parameters:
requestInfo- Data class containing information on request being sent
-
getMaxBatchSize
public int getMaxBatchSize()Description copied from interface:RateLimitingStrategyReturns the current max batch size that RateLimitingStrategy will allow through. This is required so that the component that constructs theResultInfothat is passed intoRateLimitingStrategy.shouldBlock(RequestInfo)can construct a passableResultInfo.- Specified by:
getMaxBatchSizein interfaceRateLimitingStrategy
-
builder
@PublicEvolving public static CongestionControlRateLimitingStrategy.CongestionControlRateLimitingStrategyBuilder builder()
-