This post will show how to exclude calls to external systems using Loadrunner; this allows the AUT to be tested in isolation. A typical webpage relies on a number of resources which are external to the site. Analytics services, embedded social media, advertising assets and different Google Services (maps, charts, etc.) are good examples for these.
In a typical lab-internal performance measurement one would want to make the measurement of results independent from these. Making calls to third parties is not desired or required, some reasons include:
- Calls produce unintended or even harmfull load on the third party system. (not mentioning billed usage and quotas)
- The variations in latency of the third party systems usually reduce the chance of an exact measurement.
Therefore most performance tests need to run isolated from these web-client side resources. I will explain how to go about this:
During recording, the Virtual User Generator captures not just the network traffic between your Internet browser and the system under test, but also the calls to these external resources.
By carefully examining the script generated by VuGen Recorder, you can pinpoint call-outs towards hosts other than the actual load test domain. Getting rid of these references is a good start: Manual elimination of these could simplify your load testing script too.
web_url("iPod Shuffle", "URL=http://mytestsystem.mycompany.com/opencart/index.php?route=product/product&filter_name=ipod&product_id=34", "TargetFrame=", "Resource=0", "RecContentType=text/html", "Referer=http://mytestsystem.mycompany.com/opencart/index.php?route=product/search&filter_name=ipod", "Snapshot=t3.inf", "Mode=HTML", EXTRARES, "Url=catalog/view/theme/default/image/tab.png", "Referer=http://mytestsystem.mycompany.com /opencart/index.php?route=product/product&filter_name=ipod&product_id=34", ENDITEM, "Url=http://s7.addthis.com/static/r07/widget68.css", "Referer=http://mytestsystem.mycompany.com /opencart/index.php?route=product/product&filter_name=ipod&product_id=34", ENDITEM, LAST);
During the execution of the above code, the Replay Log will contain the downloaded foreign resource:
Action.c(46): Downloading resource "http://s7.addthis.com/static/r07/widget68.css" (specified by argument number 13) [MsgId: MMSG-26577]
However removing these extra resources from the source code does not entirely solve the problem. Resource references embedded into the HTML source still will be downloaded (provided you test with”Browser Emulation/Download non-html resources” configuration enabled). To overcome this, and also add extra security for the test, these are called “download filters” and can be configured (see Runtime settings’ Internet Protocol/Download Filters section). This will allow you to specify which hosts can or can not be the target of the load test. If the load test addresses purposefully hits multiple hosts a common suffix of the hosts can also be specified (e.g. the domain name) .
After applying the Download filter, the Replay Log will indicate that the foreign resource has been blocked.
Action.c(46): Warning -26554: Not downloaded due to a filter, URL="http://s7.addthis.com/static/r07/widget68.css" [MsgId: MWAR-26554]
This is a powerful feature and come into its own if you have to re-record scripts regularly.