Monday, February 06, 2006

JNDI vs dnsjava

I've finished the benchmarks and JNDI kicked dnsjava's ass! JNDI is approximately 4x faster than dnsjava. Since we are talking about milliseconds not microseconds or nanoseconds, JNDI is the clear winner for my needs. If you are completely confused should read my previous entry.

2 comments:

  1. Do you realize the JVM by default caches DNS lookups forever. By default you have to restart the JVM for java to detect changes in DNS. Might this affect the results of your benchmark? See: http://www.rgagnon.com/javadetails/java-0445.html

    Try running the JNDI again with java -Dnetworkaddress.cache.ttl=0 your.JNDITest and see if it's really all that.

    ReplyDelete
  2. Hi Sandy. Thanks for stopping by.

    The caching done by the JVM had no effect on my benchmarks because they are unrelated. The JVM will permanently cache positive A and CNAME queries and cache, for 10 seconds, negative queries, when the queries are performed by the java.net.InetAddress class (that's where the cache is located). I'm not using InetAddress at all. JNDI's DNS bindings do not use InetAddress nor do they do any internal caching.

    ReplyDelete