0

Is it possible to use OS level DNS Cache like nscd, dnsmasq at JVM/JAVA?

I read many letters saying JVM has their own DNS caching.

https://www.ibm.com/support/pages/understanding-tuning-and-testing-inetaddress-class-and-cache https://stackoverflow.com/questions/1256556/how-to-make-java-honor-the-dns-caching-timeout

But is it possible for JVM to use system level DNS daemon such as nscd?

nimdrak
  • 29
  • 1
  • 7

1 Answers1

1

Is it possible for JVM to use system level DNS daemon such as nscd?

Not directly AFAIK, only indirectly.

The first reference starts with:

... These methods rely on the operating system to perform resolution. The operating system will attempt to resolve a given hostname by executing a lookup ... Once the operating system completes the lookup, it will pass the result back to the JVM.

Translated:

When your OS is configured to use nscd, by default the Java application using that InetAddress class implicitly follows suit.

When a resource requested by your Java application exists in the nscd cache, the OS will provide the cached resource as the response. When the requested resource doesn't exists in the cache, then the OS will have to do lookup first. The result of that lookup will both be returned to your Java application, as well as added to the nscd cache.

diya
  • 1,771
  • 3
  • 14