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

feat: kafka-logger implemented reuse kafka producer #3429

Merged
merged 13 commits into from
Jan 31, 2021

Conversation

tzssangglass
Copy link
Member

@tzssangglass tzssangglass commented Jan 26, 2021

What this PR does / why we need it:

When a topic has multiple partitions, the kafka-logger plugin creates a new producer instance to connect to kafka every time it pushes a message, which causes kafka to reallocate the partition each time, and all messages are placed in the same partition.

This PR reuse producer via lrucache to solve above problem.

fix #3384

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@tzssangglass
Copy link
Member Author

add test cases later

get partition_id for test case and debug
apisix/plugins/kafka-logger.lua Show resolved Hide resolved
apisix/plugins/kafka-logger.lua Outdated Show resolved Hide resolved
apisix/plugins/kafka-logger.lua Outdated Show resolved Hide resolved
apisix/plugins/kafka-logger.lua Outdated Show resolved Hide resolved
apisix/plugins/kafka-logger.lua Show resolved Hide resolved
apisix/plugins/kafka-logger.lua Outdated Show resolved Hide resolved
@tzssangglass
Copy link
Member Author

tzssangglass commented Jan 28, 2021

@spacewander @tokers @Firstsawyou CI is broken?

@spacewander
Copy link
Member

The CI is up now. You might need to submit a new commit to trigger it.

@tzssangglass
Copy link
Member Author

got

@tzssangglass
Copy link
Member Author

update, @spacewander @tokers @Firstsawyou pls take a look

apisix/plugins/kafka-logger.lua Outdated Show resolved Hide resolved
@spacewander spacewander merged commit d081620 into apache:master Jan 31, 2021
@tzssangglass tzssangglass deleted the IssueNo3384 branch October 26, 2021 08:29
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.

request help: unbalanced message in kafka partition using kafka-logger plugin
4 participants