Repository navigation
[flink-xxx][runtime] support dynamic rate limit source (PoC) - #29627
Open
HuangZhenQiu wants to merge 2 commits into
Open
HuangZhenQiu wants to merge 2 commits into
HuangZhenQiu wants to merge 2 commits into
Conversation
Collaborator
HuangZhenQiu
force-pushed
the
dynamic-ratelimit-source
branch
2 times, most recently
from
October 27, 2026 15:34
4c246c4 to
50b92dc
Compare
Member
Author
|
@flinkbot run azure |
HuangZhenQiu
force-pushed
the
dynamic-ratelimit-source
branch
4 times, most recently
from
November 3, 2026 06:32
2a6da25 to
c273f27
Compare
HuangZhenQiu
force-pushed
the
dynamic-ratelimit-source
branch
2 times, most recently
from
November 10, 2026 07:13
3f7a1d3 to
bb15705
Compare
HuangZhenQiu
force-pushed
the
dynamic-ratelimit-source
branch
from
November 10, 2026 21:06
bb15705 to
2bad082
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Adds an PoC of dynamic rate limit for FLIP-27 sources. When checkpoints become slow (for example under backpressure or a large backlog), the source coordinator lowers the source rate. It raises the rate again once checkpoints recover. This keeps checkpoint durations within a configurable fraction of the checkpoint interval without a hand-tuned static rate limit.
The feature is disabled by default (
source.dynamic-rate-limit.enabled=false) and only affects sources whoseSourceReaderis built withRateLimiterStrategy#dynamic(double).Brief change log
SourceCoordinatortracks checkpoint durations in a rolling window (CheckpointDurationTracker). It collects per-subtask throughput through the newReportedRecordsEvent, and broadcasts per-subtask rates through the newDynamicRateLimitEvent.RateLimitCalculatorabstraction with a defaultCheckpointDurationRateLimitCalculator. The calculator uses the min/target/max fractions of the checkpoint interval, or the duration trend when the interval is unknown. It throttles down or ramps up from the observed throughput, capped at the configured max. A custom implementation can be plugged in by class name.RateAllocationsandSubtaskRateInfosplit the global target across subtasks, falling back to an even share when a subtask has no valid rate.RateLimitedSourceReaderimplements the newSupportsDynamicRateLimit, which updates the per-subtask limit through the newDynamicRateLimiter/GuavaDynamicRateLimiter.DynamicRateLimitParamsandSourceOptions(source.dynamic-rate-limit.*). The params are wired throughSourceTransformation,SourceTransformationTranslator,SourceOperatorFactory,SourceCoordinatorProviderandSourceOperator.DataStreamSource#withDynamicRateLimitParamsoverrides the job-wide options for a single source.CheckpointCoordinator#getCurrentCheckpointIntervalis now public so the coordinator can read the current interval.Verifying this change
This change added tests and can be verified as follows:
CheckpointDurationRateLimitCalculatorTest,RateAllocationsTest,DynamicRateLimitParamsTestandRateLimitCalculatorFactoryTestcover the throttle/ramp-up logic, the allocation fallbacks, and param and calculator resolution.GuavaDynamicRateLimiterTest,RateLimitedSourceReaderTestandRateLimiterStrategyTestcover the reader-side rate updates.CheckpointDurationTrackerTestandSourceCoordinatorDynamicRateLimitTestcover coordinator behaviour: window tracking, reported-throughput handling, and broadcasting rates to registered readers.DynamicRateLimitEventTest,ReportedRecordsEventTestandDataStreamSourceTestcover the events and the per-source override.Does this pull request potentially affect one of the following parts:
@Public(Evolving): yes (new@PublicEvolvingSupportsDynamicRateLimitandSourceOptions, newRateLimiterStrategy#dynamic, newDataStreamSource#withDynamicRateLimitParams)RateLimitedSourceReader, only when the dynamic strategy is used)SourceCoordinator; feature is off by default)Documentation