Bug 43730 - User-settable JVM DNS cache expiry
Summary: User-settable JVM DNS cache expiry
Status: RESOLVED DUPLICATE of bug 56841
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.5.1
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-29 23:28 UTC by Sonam Chauhan
Modified: 2016-02-21 21:34 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sonam Chauhan 2007-10-29 23:28:59 UTC
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.)
Comment 1 Sebb 2007-10-30 05:13:00 UTC
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/).
Comment 2 Dzmitry Kashlach 2014-08-01 12:06:09 UTC
   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.
Comment 3 Philippe Mouawad 2016-02-21 21:34:18 UTC

*** This bug has been marked as a duplicate of bug 56841 ***