3

How does the JVM DNS cache deal with DNS round robin? Does it cache all IP addresses for domain and then rotate among them, or does it cache one IP address and then use it for all future requests until cache expires?

James Sumners
  • 14,485
  • 10
  • 59
  • 77
Anton
  • 31
  • 1
  • 2
  • 1
    Similar Q : http://stackoverflow.com/questions/1256556/any-way-to-make-java-honor-the-dns-caching-timeout-ttl – Santosh Aug 26 '11 at 12:08
  • This question tops the list of a search for "jvm cached dns". The similar question is helpful, but is more specific to a scenario. This question is about the general problem. Thus, I think this is the better question. – James Sumners May 21 '12 at 13:40
  • @Santosh Yep, that post describes this DNS caching issue, and several ways to change the TTL so that the values aren't cached for so long – Jon Onstott Jan 21 '16 at 20:29

1 Answers1

6

It seems the JVM does not rotate the IP addresses. It just picks up the one address and uses it for the lifetime of the process. Check out this article from SUN/Oracle. The only way out seems to be either tun off the DNS caching altogether or keep a low ttl time. Check out the following link as well.

http://www.verisigninc.com/assets/stellent/030957.pdf

Santosh
  • 17,667
  • 4
  • 54
  • 79