flink
flink copied to clipboard
[FLINK-34559] Limit Global & Local Aggregation buffers
What is the purpose of the change
Limit Global Aggregation buffers
In case of large windows and/or lagging watermarks,
RecordsWindowBuffer processes buffered records and flushes the state
during the sync phase of the checkpoint causing checkpoint timeout.
This change limits the number of records buffered and the buffer size.
Limit Local Aggregation buffers
The buffer holds records for aggregation in memory and is flushed downstream on:
1) checkpoints, 2) watermarks, or 3) when it is full.
If it's too big (even if watermarks are progressing),
there might be much more data to flush than the memory available (classic flatMap problem).
That might lead to back-pressure and hard-blocking the task thread.
This change limits the buffer and the number of records.
Verifying this change
Please make sure both new and modified tests in this PR follow the conventions for tests defined in our code quality guide.
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
- Added integration tests for end-to-end deployment with large payloads (100MB)
- Extended integration test for recovery after master (JobManager) failure
- Added test that validates that TaskInfo is transferred only once across recoveries
- Manually verified the change by running a 4 node cluster with 2 JobManagers and 4 TaskManagers, a stateful streaming program, and killing one JobManager and two TaskManagers during the execution, verifying that recovery happens correctly.
Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): (yes / no)
- The public API, i.e., is any changed class annotated with
@Public(Evolving)
: (yes / no) - The serializers: (yes / no / don't know)
- The runtime per-record code paths (performance sensitive): (yes / no / don't know)
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / no / don't know)
- The S3 file system connector: (yes / no / don't know)
Documentation
- Does this pull request introduce a new feature? (yes / no)
- If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)