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

[BROOKLYN-579] Add DNS TTL configuration via envvar #121

Merged
merged 2 commits into from May 31, 2018

Conversation

Projects
None yet
3 participants
@tbouron
Copy link
Member

commented May 24, 2018

Before, java was not refreshing the DNS records, ever. This is due to the default networkaddress.cache.ttl set to -1, i.e. cache forever.

This PR updates the system property sun.net.inetaddr.ttl to 60 by default. It uses sun.net.inetaddr.ttl because networkaddress.cache.ttl is not a system property. But this has the desirable effect (see: https://stackoverflow.com/a/17219327)

@@ -85,6 +89,9 @@ export EXTRA_JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 ${EXTRA_
# Increase garbage collection, see https://issues.apache.org/jira/browse/BROOKLYN-375
export EXTRA_JAVA_OPTS="-XX:SoftRefLRUPolicyMSPerMB=1 ${EXTRA_JAVA_OPTS}"

# Set the DNS TTL for the JVM
export EXTRA_JAVA_OPTS="-Dsun.net.inetaddr.ttl=${DNS_TTL} ${EXTRA_JAVA_OPTS}"

This comment has been minimized.

Copy link
@geomacy

geomacy May 30, 2018

Contributor

It would be nicer not to use the sun private system property but I take your point about the other value being a security property. I had a look to see if Karaf would let us specify this somehow but I don't see a way to do that. (You can configure security providers but there doesn't seem to be an equivalent for security properties.)

At the least though I would add some comment here explaining the use of sun.net - even just copy the text from the description of this PR.

This comment has been minimized.

Copy link
@tbouron

tbouron May 30, 2018

Author Member

@geomacy Indeed, it is annoying that we cannot control the networkaddress.cache.ttl directly hence why I went for the old sun.net.inetaddr.ttl property.

Good idea though, I'll add a comment

@tbouron

This comment has been minimized.

Copy link
Member Author

commented May 30, 2018

@geomacy I added the comment, should be ok now.

@asfgit asfgit merged commit 62d4275 into apache:master May 31, 2018

1 check passed

Jenkins: brooklyn-dist-pull-request SUCCESS 5 tests run, 1 skipped, 0 failed.
Details

asfgit pushed a commit that referenced this pull request May 31, 2018

Closes #121
[BROOKLYN-579] Add DNS TTL configuration via envvar

Before, java was not refreshing the DNS records, ever. This is due to the default `networkaddress.cache.ttl` set to `-1`, i.e. cache forever.

This PR updates the system property `sun.net.inetaddr.ttl` to `60` by default. It uses `sun.net.inetaddr.ttl` because `networkaddress.cache.ttl` **is not** a system property. But this has the desirable effect (see: https://stackoverflow.com/a/17219327)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.