Pages

Monday, 30 January 2017

JMeter - Config Element - "DNS Cache Manager"

To make sure sites are seamless and robust, most companies turn to Network Load Balancing as a solution. This helps them to ensure that their service will remain operable - even when there are unexpected circumstances or failure in any of the instance. Such testing can be conducted with the help of “DNS Cache Manager” element which allows testing the applications, which have several servers behind load balancers like CDN (Content Delivery Networks) when the user receives content from different IP's. By default, JMeter uses JVM DNS cache. That's why only one server from the cluster receives the load. DNS Cache Manager element resolves name for each thread separately in each iteration so that load can be balanced by the load balancer. DNS Cache Manager sends requests which are independent of both JVM and OS DNS caches.

How to add "DNS Cache Manager" element?
You can follow below steps:
1. Select "Test Plan" node
2. Right click on "Test Plan" node
3. Mouse hover "Add"
4. Mouse hover "Config Element"
5. Click "DNS Cache Manager"
Apache JMeter - DNS Cache Manager


How to remove "DNS Cache Manager" element?
You can follow below steps:
1. Select "DNS Cache Manager" node
2. Right click on "DNS Cache Manager" node
3. Click "Remove" (Mouse) or "Delete" button from keyboard
4. Click "Yes"
Apache JMeter - DNS Cache Manager

What are the attributes of "DNS Cache Manager" element?
"DNS Cache Manager" has below attributes:
a. Name: To provide element name
b. Comments: To provide arbitrary comments (if any)
c.  Clear Cache Each Iteration: If selected, DNS cache of every Thread is cleared each time when a new iteration is started. The DNS Cache Manager caches the IP address and DNS hostname pairs and returns the cached value if the DNS hostname has a match in its internal cache. If this checkbox is ticked, the cache will be cleared at the start of the thread.
d. Use System DNS Resolver: The DNS Cache Manager will query DNS Server(s) defined in your OS network configuration in order to determine the hostname for each thread representing virtual users. In this case, you need to override the networkaddress.cache.ttl property in the $JAVA_HOME/jre/lib/security/java.security file and set it to "0" (the property defaults to “-1” which stands for “forever”)
e. Use Custom DNS Resolver: You can specify one or more DNS servers in the list. 

  • If more than one server is provided, the DNS Cache Manager will choose a random one for each call - and will run as a round-robin mechanism.
  •  If nothing is provided, the system DNS resolver will be used (the DNS server/s defined in your OS network configuration)
f.  Hostname or IP address: You can provide list of DNS servers to be used during test. If you have selected "Use Custom DNS Resolver" and keep "Hostname or IP address" field empty then network configuration DNS will be used. 
g. Add: To Add an entry to the DNS servers table
h. Delete: To delete the selected DNS server entry   

Some important Tips:
  • Do not place DNS Cache Manager as a child element of particular HTTP Sampler. The DNS Cache Manager should be added as a child of the Test Plan or a Thread Group element.
  • DNS Cache Manager working only with the HTTP request using HTTPClient4 implementation.
Next Topic:
Apache JMeter - "FTP Request Defaults" Element

Previous Topic:
Apache JMeter - "CSV Data Set Config" Element

Related Topics:

No comments:

Post a Comment