Background
The DNS cache is a temporary storage of DNS records of resolved domain names
A Time to Live (TTL) field controls how long each record is valid
On Unix-like systems there is no OS-level DNS cache
On Windows systems there is an OS-level DNS cache with a TTL of 1 day or less.
On JVM level the DNS cache TTL is infinite by default for on-premise and 30 seconds for SaaS environments.
Instructions
To flush the cache on Windows issue ipconfig /flushdns (or Clear-DnsClientCache in powershell)
To flush the cache on JVM restart the JVM
To set a DNS cache TTL of 60 seconds for on-premise edit java.security (ie /etc/java-17-openjdk/security/java.security) and change
#networkaddress.cache.ttl=-1 into
networkaddress.cache.ttl=60
To test settings issue following in Scripting > Shell
import java.net.InetAddress;
{
InetAddress address = InetAddress.getByName("<host>");
jcsOut.println(address.getHostAddress());
jcsOut.println(address.getHostName());
jcsOut.println(java.security.Security.getProperty("networkaddress.cache.ttl"));
}
Comments
0 comments
Please sign in to leave a comment.