Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process Data-ingestion messages through Batched async mechanism to improve throughput. #71

Merged

Conversation

nithin-pankaj
Copy link
Contributor

Current Problem :
Presently, only a single Listener container is generated to consume messages from the Connectors ingestion Topic (across all the partitions) . This Listener sequentially processes each record returned by the internal poll() method which eventually affects the overall throughput of Connector, since the downstream TransactionConsumer#listen does a blocking call for writing transactions which could span for few seconds.
Therefore given a scenario where TransactionConsumer#listen takes 2 seconds complete, in order to process 100 incoming records fetched by the poll() method it takes around 50 seconds.

Proposed Fix :
Assign a dedicated Listener Container for each partition in the Topic, per connector instance (capped to a max of 6 Listeners, in order to avoid spawning a large number of Listeners for high-partitioned Topics ).
Each Listener gets a batch of Messages from the Partition it is assigned to, this batch is processed asynchronously by submitting it to a task executor in one go. The Listener thread defers the next poll until the entire records are processed parallelly. Once the batch is processed, Listener gets the next Batch from poll()
In case one of the records encounters an exception while processing parallelly, we perform a partial Batch commit and the failed and unprocessed records are sent again in the next poll()

“Nithin added 2 commits December 26, 2022 13:13
Signed-off-by: “Nithin <nithin.pankaj@walmartlabs.com>
Signed-off-by: “Nithin <nithin.pankaj@walmartlabs.com>
@nithin-pankaj nithin-pankaj requested a review from a team as a code owner December 26, 2022 08:12
@arsulegai arsulegai merged commit 585da3a into hyperledger-labs:main Dec 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants