accessing remote servers which have a changing (dynamic, dyndns) ip address

When accessing remote servers from java code, and these servers have a dynamic IP address, then you may notice that the system becomes unavailable more often than expected.

In general, dynamic IP addresses can cause availability problems. Through the DNS data will generally be marked to expire every three or five minutes, you may notice that it takes considerably longer for changes to propagate. It seems (though I am guessing here) that some DNS servers do not consider these expiration fields, or possible only sweep there cache looking at these timestamps at certain intervals (which may increase the expiration to the next cache sweep).

However, in java code, thing become increasingly worse as the default setting is to cache dns mappings, never clean/sweep the cache and not look at the expiration fields.

To fix this, you should add the following configuration when starting your java application.

-Dsun.net.inetaddr.ttl=15

In this example, the “time to live” is set to fifteen seconds.

Leave a Reply

Your email address will not be published. Required fields are marked *

question razz sad evil exclaim smile redface biggrin surprised eek confused cool lol mad twisted rolleyes wink idea arrow neutral cry mrgreen

*