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

Improved hostname resolution for Graphite connections #8787

Merged
merged 1 commit into from Feb 13, 2017
Merged

Improved hostname resolution for Graphite connections #8787

merged 1 commit into from Feb 13, 2017

Conversation

spacecowboy
Copy link
Contributor

This should fix a dead graphite metric in the case when the DNS
resolution to the graphite server updates while neo4j is running.

This should fix a dead graphite metric in the case when the DNS
resolution to the graphite server updates while neo4j is running.
@spacecowboy
Copy link
Contributor Author

spacecowboy commented Feb 10, 2017

@benbc @praveenag some proof that this works.

Java DNS TTL settings

See https://docs.oracle.com/javase/7/docs/technotes/guides/net/properties.html

I have confirmed results when I set the java dns ttl, file

/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security

on my system. It is possible that it works without this on openjdk but there was a significant delay before the metrics kick in again which I didn't expect. Basically, all connections in neo4j must timeout before a new resolution is attempted and that takes a couple of minutes.

#
# The Java-level namelookup cache policy for successful lookups:
#
# any negative value: caching forever
# any positive value: the number of seconds to cache an address for
# zero: do not cache
#
# default value is forever (FOREVER). For security reasons, this
# caching is made forever when a security manager is set. When a security
# manager is not set, the default behavior in this implementation
# is to cache for 30 seconds.
#
# NOTE: setting this to anything other than the default value can have
#       serious security implications. Do not set it unless
#       you are sure you are not exposed to DNS spoofing attack.
#
networkaddress.cache.ttl=10

# The Java-level namelookup cache policy for failed lookups:
#
# any negative value: cache forever
# any positive value: the number of seconds to cache negative lookup results
# zero: do not cache
#
# In some Microsoft Windows networking environments that employ
# the WINS name service in addition to DNS, name service lookups
# that fail may take a noticeably long time to return (approx. 5 seconds).
# For this reason the default caching policy is to maintain these
# results for 10 seconds.
#
#
networkaddress.cache.negative.ttl=10

Screenshots of graphite with this fix

Note that I tested it twice just to make sure I did it right, hence the two gaps. I did not restart neo4j, I only changed the Route53 dns and waited.

graphite dashboard - chromium_002

@benbc
Copy link
Contributor

benbc commented Feb 10, 2017

Cool. I'd absolutely expect there to be a gap if I'm messing around with the DNS. As long as it recovers, that's fine.

So do we need to document the JRE configuration?

@spacecowboy
Copy link
Contributor Author

@benbc not sure where though. I don't think we have any specific graphite docs.

@spacecowboy spacecowboy merged commit dd76149 into neo4j:2.3 Feb 13, 2017
@spacecowboy spacecowboy deleted the 2.3-graphitedns branch February 13, 2017 09:48
@spacecowboy spacecowboy changed the title Changed graphite connection to with hostname instead of resolved ip Improved hostname resolution for Graphite connections Feb 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants