Decouple control topic processing from record poll loop – improve throughput & reliability#16084
Open
kumarpritam863 wants to merge 36 commits intoapache:mainfrom
Open
Decouple control topic processing from record poll loop – improve throughput & reliability#16084kumarpritam863 wants to merge 36 commits intoapache:mainfrom
kumarpritam863 wants to merge 36 commits intoapache:mainfrom
Conversation
This reverts commit 67619ec.
This reverts commit c0a2665.
…onnect/channel/Worker.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…onnect/channel/Worker.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Replaced Thread.sleep with Awaitility for better to avoid flakiness.
Contributor
Author
|
@danielcweeks can you please review this too. This is a change that will decouple the kafka polling from the main record writing flow and resolves few of the issues raised by the users and it will also avoid delays in metadata commit. |
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.
Problem Statement
Currently, workers poll the control topic inside the main record-processing loop using
poll(Duration.ZERO). This tightly-coupled design leads to several critical issues:Missed START_COMMIT at startup
Initial partition assignment delays cause workers to frequently miss the first
START_COMMITfrom the coordinator → delayed snapshot creation at destination.Throughput blocked by control-topic latency
Any intermittent Kafka latency or outage on the control topic completely blocks file writing → throughput degradation.
Unreliable zero-duration polling
Duration.ZEROonly works reliably with constant traffic. When no records are buffered on the broker, workers missSTART_COMMITcycles (both at start and mid-stream).Wasteful processing of irrelevant events
All workers consume the same control topic → every worker unnecessarily processes the events of other workers and discards on the main record write path.
Solution
This PR completely decouples control-topic processing from the main record-processing flow by:
START_COMMIT,COMMITTED, etc.) in a thread-safe queue.The main poll loop now only consumes data topics and is no longer blocked or distracted by the control topic.
Benefits
Validation
Addresses ::
#14818
#14816