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
ARateLimitingStrategyimplementation 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 Modifier and Type Class Description static classCongestionControlRateLimitingStrategy.CongestionControlRateLimitingStrategyBuilderBuilder forCongestionControlRateLimitingStrategy.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CongestionControlRateLimitingStrategy.CongestionControlRateLimitingStrategyBuilderbuilder()intgetMaxBatchSize()Returns the current max batch size that RateLimitingStrategy will allow through.voidregisterCompletedRequest(ResultInfo resultInfo)Registers the result of completed requests (e.g.voidregisterInFlightRequest(RequestInfo requestInfo)Registers the information of requests being sent (e.g.booleanshouldBlock(RequestInfo requestInfo)Decides whether the next request should be blocked.
-
-
-
Method Detail
-
registerInFlightRequest
public void registerInFlightRequest(RequestInfo requestInfo)
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
public void registerCompletedRequest(ResultInfo resultInfo)
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
public boolean shouldBlock(RequestInfo requestInfo)
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()
-
-