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

fix: Re-use TCP connections for Kafka dials #18860

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

Praveenrajmani
Copy link
Contributor

Community Contribution License

All community contributions in this pull request are licensed to the project maintainers
under the terms of the Apache 2 license.
By creating this pull request I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 license.

Description

The connections should be properly closed on kafka target pings

Motivation and Context

Fixes #18857

How to test this PR?

  • Configure bucket notifications + kafka
  • Trigger events
  • Check netstat if there are too many ESTABLISHED connections without being closed

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Optimization (provides speedup with no functional changes)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Fixes a regression (If yes, please add commit-id or PR # here)
  • Unit tests added/updated
  • Internal documentation updated
  • Create a documentation update request here

@Praveenrajmani
Copy link
Contributor Author

We can also assign a single connection per broker and reuse it instead of doing net.Dial each time. Will fix.

@bh4t bh4t added the bugfix label Jan 24, 2024
@Praveenrajmani Praveenrajmani changed the title fix: Close the connections on kafka target pings fix: Re-use TCP connections for Kafka dials Jan 24, 2024
@harshavardhana harshavardhana merged commit c905d3f into minio:master Jan 24, 2024
20 checks passed
@mctoohey
Copy link
Contributor

Thanks @Praveenrajmani for the fix!
I just tried out this change. Looks good! I no longer see hundreds of new connections being opened and the number of failures sending to Kafka due to this issue has gone to zero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

isActive check on Kafka event target can consume ephemeral port range
4 participants