Skip to content

DNS Cache Manager

Configure the JMeter DNS Cache Manager configuration elements: properties, defaults, and practical usage notes for building reliable load tests.

Difficulty
intermediate
Guide type
reference
Estimated read time
2 min read
Last verified version
Verified JMeter 5.6

Part of the Configuration Elements category. Also documented in context in the full Component Reference.

DNS Cache Manager

The DNS Cache Manager element allows to test applications, which have several servers behind load balancers (CDN, etc.), when user receives content from different IP’s. By default JMeter uses JVM DNS cache. That’s why only one server from the cluster receives load. DNS Cache Manager resolves names for each thread separately each iteration and saves results of resolving to its internal DNS Cache, which is independent from both JVM and OS DNS caches.

A mapping for static hosts can be used to simulate something like /etc/hosts file. These entries will be preferred over the custom resolver. Use custom DNS resolver has to be enabled, if you want to use this mapping.

Say, you have a test server, that you want to reach with a name, that is not (yet) set up in your DNS servers. For our example, this would be www.example.com for the server name, which you want to reach at the IP of the server a123.another.example.org.

You could change your workstation and add an entry to your /etc/hosts file - or the equivalent for your OS, or add an entry to the Static Host Table of the DNS Cache Manager.

You would type www.example.com into the first column (Host) and a123.another.example.org into the second column (Hostname or IP address). As the name of the second column implies, you could even use the IP address of your test server there.

The IP address for the test server will be looked up by using the custom DNS resolver. When none is given, the system DNS resolver will be used.

Now you can use www.example.com in your HTTPClient4 samplers and the requests will be made against a123.another.example.org with all headers set to www.example.com.

NameRequiredDescription
NameNoDescriptive name for this element that is shown in the tree.
Clear cache each IterationNoIf selected, DNS cache of every Thread is cleared each time new iteration is started.
Use system DNS resolverN/ASystem DNS resolver will be used. For correct work edit $JAVA_HOME/jre/lib/security/java.security and add networkaddress.cache.ttl=0
Use custom DNS resolverN/ACustom DNS resolver (from dnsjava library) will be used.
Hostname or IP addressNoList of DNS servers to use. If empty, network configuration DNS will used.
Add ButtonN/AAdd an entry to the DNS servers table.
Delete ButtonN/ADelete the currently selected table entry.
Host and Hostname or IP addressNoMapping of hostnames to a static host entry which will be resolved using the custom DNS resolver.
Add static host ButtonN/AAdd an entry to the static hosts table.
Delete static host ButtonN/ADelete the currently selected static host in the table.
On this page