2012년 1월 25일 수요일

[WebSphere] DNS caching ability of the SDK

 DNS caching ability of the SDK

 

Problem(Abstract)

The java.net.InetAddress class has a cache in which successful, as well as unsuccessful, host name resolutions are stored.

Cause

The caching function allows the result of a name resolution be stored in a cache.

Resolving the problem

The java.net.Inetaddress class provides methods to resolve hostnames. These methods use the operating system to actually resolve the hostname. Based upon operating system settings, the operating system may retrieve the address from a file or may go to a DNS server. This is not controlled by the SDK and the SDK does not go directly to the DNS server. The SDK does not cache the DNS server address and is not involved in DNS failover.
Once the operating system determines the address, it will pass it back to the JVM. The address is then stored in the cache. By default, the result of a positive name resolution is cached forever. The result of an unsuccessful name resolution is cached for a very short period of time to improve performance.

There is one exception. The method getLocalHost is used to resolve the local hostname. By default, this is not cached. To cache the local hostname resolution, you can specify the following parameter:


-Dcom.ibm.cacheLocalHost=True. ​

The SDK provides the following properties to control network address caching:

networkaddress.cache.ttl (default: -1) ​

Specified in java.security to indicate the caching policy for successful name lookups. The value is specified as an integer to indicate the number of seconds to cache the successful look-up.

A value of -1 indicates cache forever.


networkaddress.cache.negative.ttl (default 10)​

Specified in java.security to indicate the caching policy for unsuccessful name lookups. The value is specified as an integer to indicate the number of seconds to cache the failure for unsuccessful look-ups.

A value of 0 indicates never cache. A value of -1 indicates cache forever.




You can also specify these as generic JVM arguments:
-Dsun.net.inetaddr.ttl=​value​

This corresponds to networkaddress.cache.ttl and has the same meaning and takes the same values, but can be used as a command-line option.

-Dsun.net.inetaddr.negative.ttl=​value​

This corresponds to networkaddress.cache.negative.ttl and has the same meaning and takes the same values, but can be used as a command-line option.

Note : When you upgrade the SDK, the java.security file wil be replaced with a new copy. If you are specifying these parametes in java.security, you will need to modify the file each time you upgrade the SDK.




There are no recommended guidelines on setting these parameters. When you select values, consider the following things:

댓글 없음:

댓글 쓰기