- Prefer IPv4
Starting with version 4, Java performs both IPv6 and IPv4 DNS lookups. If the DNS server is not set up to properly respond to IPv6 queries, then Java will wait for the IPv6 query to time out. This can manifest in what looks like network slowdowns.
To bypass IPv6 DNS lookups, set the Java System property java.net.preferIPv4Stack to true.
Command line: -Djava.net.preferIPv4Stack=true Java:
System.setProperty("java.net.preferIPv4Stack",
"true"); - Increase cache time
When a Java 6 security manager is not set, the default DNS cache is 30 seconds. To reduce network DNS queries, the number of seconds of DNS cache can be increased by setting the networkaddress.cache.ttl System property. Set this property to -1 to never expire the DNS cache.
Command line: -Dnetworkaddress.cache.ttl=-1
Java:System.setProperty("networkaddress.cache.ttl",
SyntaxHighlighter JS
2013-01-13
Optimize Java DNS Lookup
Subscribe to:
Post Comments (Atom)
This is exactly why people need to have use more secure VPN’s. The free ones are never okay. Yes, I speak from experience. One of my bosses caught me on YouTube at work. Just YouTube and I still got reprimanded. It was so embarrassing and I thought I had a reliable VPN. Anyway, I got ExpressVPN on my work laptop and thank goodness they have good security tools — including the DNS leak test, a WebRTC leak test and an IP address test.
ReplyDelete