After the host name is resolved to an IP address, the resource IP address is saved in the cache of the JVM. If the IP address of the resource is changed, you need to restart the application server to enable Identity Manager to detect the change (id-3635). This is a setting in sun JDK (version 1.3 and later), which can be controlled by using the sun.net.inetaddr.ttl property (usually set in JRE/lib/security/Java. Security)
//Set the effective time of the cache in the JVM for successfully resolved domain name records. By default, the JVM is always valid. In this way, the domain name IP redirection must restart the JVM. Here, it is modified to be valid for 5 seconds. 0 means that the cache is forbidden and – 1 means that it is always valid
java.security.Security.setProperty(“networkaddress.cache.ttl”, “5”);
//Set the valid time of the cache in the JVM for the domain name record that failed to be resolved. The default time of the JVM is 10 seconds. 0 means that the cache is forbidden, and – 1 means that it is always valid
java.security.Security.setProperty(“networkaddress.cache.negative.ttl”,”2″);
There are also two ways to set DNS cache
1. In Java_ Setting in opts
-Dsun.net.inetaddr.ttl=3 -Dsun.net.inetaddr.negative.ttl=1
2. Modify property
System.setProperty(“sun.net.inetaddr.ttl”, “3”);
System.setProperty(“sun.net.inetaddr.negative.ttl”, “1”);
In general, we don’t need to cancel the DNS cache of the JVM completely, we just need to reduce the effective time
1) One domain name corresponds to one IP and one domain name corresponds to 12 IPS. There is little difference in DNS query response time, and the latter takes up a little more CPU;
2) In the case of high concurrency, the CPU consumption without DNS caching is 3/4 times higher than that with 3S caching, and real-time DNS requests consume CPU;
3) There is little difference between 3S and 30s cache effective time on DNS query response time, and CPU memory consumption is close;
4) It is recommended to use 3-second cache to take care of operation, maintenance and performance;
Reference documents: http://www.verisigninc.com/assets/stellent/030957.pdf
Similar Posts:
- 127.0.1.1 host address in Debian (Ubuntu) hosts file
- Java system. Currenttimemillis() and system. Nanotime
- The meaning of WNS, WHS, TNS and ths in vivado
- Workaround for “could not retrieve mirrorlist” during Yum installation
- Deploying multiple jbosserror: transport error 202: bind failed in Linux
- Trouble Connecting to sql server Login failed. “The login is from an untrusted domain and cannot be used with Windows authentication”
- The difference between system.err.println and system.out.println
- GC plug in of jvasualvm + error “not supported for this JVM” + command jstatd
- [Solved] Prometheus Time Error: Warning! Detected 60.44 seconds time difference between your browser and the server. Prometheus relies on accurate time and time drift might cause unexpected query results.
- Solve the problem of “Please provide a valid cache path” in Laravel/Lumen