I understand that the JVM caches successfull DNS name lookups forever by default. This is confirmed by this document (see note on networkaddress.cache.ttl property): http://java.sun.com/j2se/1.4.2/docs/guide/net/properties.html The Java DNS cache ignores the DNS TTL property. This can cause issues, for instance with a long-running test when an IP address changes on a server farm, or when DNS round-robin load balancing is used during a load test (a JMeter instance will only ever test one node in a cluster). Can JMeter be enhanced to allow the user to override Java's default DNS- caching behaviour in a user-setting at the beginning of the test? This will enable it to work properly (i.e. as a browser would) in these scenarios. The setting would allow the user to set a time limit on networkaddress.cache.ttl - it could be set to emulate IE (30 minutes, according to some reports) or Firefox (1 minute). This issue was discussed on the JMeter users list towards end-October 2007: http://mail-archives.apache.org/mod_mbox/jakarta-jmeter-user/200710.mbox/% 3cE5D178BFB0356B48A48B8330B2903721035E76B2@syd1exc04.CE.CORP%3e This could be implemented as part of a more generic control to set the Java Network properties (see the first link above.)
As a work-round for Sun JVMs, the property sun.net.inetaddr.ttl can be set on the command-line using -D or in the JMeter file system.properties. Other Java networking properties can be set on the command-line or in system.properties. It is only networkaddress.cache.ttl that cannot be set this way; it would need to be set by: java.security.Security.setProperty("networkaddress.cache.ttl" , "0"); This can be done with the current JMeter by using the JMeter property beanshell.init.file which names a BeanShell script to be run at startup. Of course this requires that the BeanShell jar has been put on the classpath (e.g. in lib/).
Sebb, a question: can it be, for instance, config element, say, something like "DNS Cache Manager", with its own cache and ability to set up DNS server for particular sampler? Using such approach we can bypass JVM & OS cache and it could solve problem.
*** This bug has been marked as a duplicate of bug 56841 ***
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2042