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

Removed caching of the DNS resolution - the code will now rely on the… #124

Merged
merged 2 commits into from
Sep 2, 2021
Merged

Removed caching of the DNS resolution - the code will now rely on the… #124

merged 2 commits into from
Sep 2, 2021

Conversation

gaspardpetit
Copy link
Contributor

… JVM's cache instead and rely on the networkaddress.cache.ttl security property;

For the UDP sender, also added a refresh of the channel every 5 minutes - otherwise the same channel would keep sending to the same IP forever.

Signed-off-by: Gaspard Petit [email protected]

… JVM's cache instead and rely on the networkaddress.cache.ttl security property;

For the UDP sender, also added a refresh of the channel every 5 minutes - otherwise the same channel would keep sending to the same IP forever.

Signed-off-by: Gaspard Petit <[email protected]>
@gaspardpetit
Copy link
Contributor Author

This would resolve the following issue: #70

@gaspardpetit
Copy link
Contributor Author

With this solution, every new reconnect of the GelfTCPSender.java will lookup the hostname instead of reuse the cached resolution. Bear in mind that this ends up using the JVM's DNS cache, so it's not an actually lookup every time.

For the GelfUDPSender.java I had to do it in two places: (1) lookup hostname instead of cached resolution and (2) force refresh of the UDP channel since otherwise it would remain open and clueless about the change forever. I used 5 mins, hardcoded - this is a reasonable value for us, but if somebody else wants to improve with configurable settings, that would be an improvement. Keep in mind that refreshing a datagram channel is quite fast since there is no remote connection involved.

@gaspardpetit gaspardpetit reopened this Jun 30, 2018
@gaspardpetit gaspardpetit reopened this Jul 4, 2018
@t0xa t0xa merged commit cb458f6 into t0xa:master Sep 2, 2021
@gaspardpetit gaspardpetit deleted the rely_on_jvm_dns_cache branch April 11, 2022 19:10
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.

2 participants