Principle:Apache Flink Congestion Control Rate Limiting
| Knowledge Sources | |
|---|---|
| Domains | Stream_Processing, Flow_Control |
| Last Updated | 2026-02-09 00:00 GMT |
Overview
A TCP-inspired congestion control mechanism that dynamically adjusts the rate of asynchronous requests based on success and failure feedback using AIMD (Additive Increase, Multiplicative Decrease) scaling.
Description
Congestion Control Rate Limiting prevents overwhelming the destination system by dynamically adjusting the allowed number of in-flight messages. Inspired by TCP congestion control, it uses an AIMD scaling strategy:
- Additive Increase: On successful completion, increase the allowed messages by a fixed increment
- Multiplicative Decrease: On failure (partial or complete), decrease the allowed messages by a multiplicative factor
The strategy also enforces absolute limits on concurrent in-flight requests. When the current in-flight count exceeds the dynamic limit, the writer blocks until capacity is available.
Usage
Use this principle when the destination system has variable throughput or can be overwhelmed by too many concurrent requests. The AIMD parameters should be tuned to the destinations characteristics: faster increase for stable systems, more aggressive decrease for fragile ones.
Theoretical Basis
// AIMD Algorithm
function scaleUp(currentRate):
return currentRate + increaseRate // e.g., +10
function scaleDown(currentRate):
return max(rateThreshold, currentRate * decreaseFactor) // e.g., * 0.5
function shouldBlock(requestInfo):
return inFlightRequests >= maxInFlightRequests
OR inFlightMessages >= maxInFlightMessages