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

Kafka Sarama client, optimize by not loading all metadata #3247

Closed
famarting opened this issue Nov 23, 2023 · 8 comments
Closed

Kafka Sarama client, optimize by not loading all metadata #3247

famarting opened this issue Nov 23, 2023 · 8 comments
Labels
kind/enhancement New feature or request stale

Comments

@famarting
Copy link
Contributor

Describe the feature

The kafka client used for the kafka components implementation by default has a feature that loads all the topics metadata on initialization, and keeps in memory the metadata for all the topics in the kafka cluster. This is inefficient and memory hungry in scenarios where the kafka cluster used has many topics.

The config property can be found here https://github.com/IBM/sarama/blob/main/config.go#L157

I suggest Dapr always disables that feature in the Sarama client

Release Note

RELEASE NOTE: UPDATE Optimize kafka components for clusters with many topics

RELEASE NOTE:

@famarting
Copy link
Contributor Author

not applicable

@olitomlinson
Copy link

I think its worth re-opening this issue.

I'm not entirely sure why the associated PR was closed tbh, it could be viable!

For context : we have a use case where thousands of partitions on the Kafka cluster are related to Kafka Topics that are never going to be used by Dapr sidecars. So having Dapr load all this metadata on init and refresh it is highly wasteful.

cc @artursouza

@famarting
Copy link
Contributor Author

I closed the issue because I realized the changes needed to make it work were much larger than what I anticipated...

My hope was that by simply changing a flag, sarama would lazyly read the topic metadata as they are used by produce or consume calls... however that was not the case since I discovered the hard way that sarama requires you to pass the list of topics you'll want to use, maybe after providing an initial list sarama can lazy load new topics... but I didnt get to that point

The issue could be reopened or a new one could be created with a more specific requirement or at least after some more research on what can be done with sarama in terms of optimizing loading the topics metadata

@famarting
Copy link
Contributor Author

I'm playing a bit with the sarama client again and I think I was suffering from this two issues

IBM/sarama#2630
IBM/sarama#2069

@famarting
Copy link
Contributor Author

this has not actually been addressed, I found a way of fixing this, it will require a contribution to the sarama client first

Copy link

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Apr 10, 2024
Copy link

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. Thank you for your contributions.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 17, 2024
@famarting
Copy link
Contributor Author

in case anyone sees this, I already have all the code in place but first we need my contribution here to be accepted and released IBM/sarama#2830

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants