×

Testing for performance is only half the battle. At some point, you must actually implement performance optimizations and compare results to make sure your site is getting faster. Sometimes you want to test out an optimization, such as using a different CDN or loading assets from a different system. Other times you want to understand if a specific piece of third party content is a single point of failure. In this post we’ll discuss two methods for testing optimizations without making major changes to your site’s source code:

  • Using DNS Overrides to test how requests from different domains would affect performance
  • Creating simulated failed requests to see how Single Points of Failure (SPOFs) would affect performance

Testing with DNS Overrides

DNS Overrides allow you to change a request to a specific domain to instead go to a different IP address or hostname. This is helpful because you can test specific types of requests without modifying the HTML source.

For example, let’s imagine that we want to test the media website CNN.com to see what performance issues would be resolved using a different content delivery network (CDN) provider. Right now, CNN is using a CDN at i2.cdn.turner.com. If you look in the HTML source, you will see links to that host. If you wanted to test a new CDN, you could go through and modify the CNN’s backend to change all those links to use a different CDN, such as CloudFront. Unfortunately, this is a ton of work, and it requires the ability to modify source code on CNN.com, which you may or may not have. This is where we can use DNS overriding.

You can configure performance tools such as Rigor Optimization to scan CNN.com and use DNS overrides so that all requests to i2.cdn.turner.com will instead be sent to d37gvrvc0wt4s1.cloudfront.net instead. You can see this in the screen shot below:

cnn

During the scan, when Rigor Optimization sees a URL to i2.cdn.turner.com, like this image, it will instead make a connection to d37gvrvc0wt4s1.cloudfront.net. Rigor then makes the same request to d37gvrvc0wt4s1.cloudfront.net that it would have made to i2.cdn.turner.com, complete with a Host header. In the screenshot below we can see this example:

override-request

We can see Rigor Optimization is auditing this URL. However, it makes a connection to d37gvrvc0wt4s1.cloudfront.net and sends that request. Rigor Optimization includes a special X-DNS-Override-To: header so you can see what location Rigor Optimization actually sent this request to.

With DNS overriding, you can test whether one CDN is better than another for your site without all of the complexity of changing your backend. This makes DNS overriding an excellent way to forecast the impact of optimizations.

Testing for Single Points of Failure

Another great use of DNS overriding is testing if a third party script is a single point of failure (SPOF). Consider the main page on IBM. Looking at the HTML source, we can see a blocking request to third-party JavaScript from Optimizely:

ibm-source

This page loads in about 19 seconds, as you can see the waterfall here:

ibm-good

We can see that the request to Optimizely is right now the top. Now let’s see what happens to IBM’s performance if Optimizely’s systems went down. We can use DNS Overrides to simulate a failure of Optimizely by sending requests to cdn.optimizely.com to blackhole.webpagetest.org. This is a special domain that never responds to any requests or connection attempts, and it perfectly replicates an unresponsive server.

Here is the Waterfall when we create a SPOF with cdn.optimizely.com:

Ouch! There is a huge gap in the waterfall as the browser waits (in vain) for a response from Optimizely/The Black Hole. Start Render time increases from 3.5 seconds in the first run to over 34 seconds with the SPOF! This is because, as a blocking JavaScript file, the browser cannot draw until it gets a response for the JS file or the request times out. IBM is at serious risk of terrible performance, and it largely depends on whether Optimizely’s 3PC responses happen in a reasonable amount of time. For the record, having the ultimate user experience of your site be dominated by the performance of a resource beyond your control is a recipe for disaster.

Next Steps

Rigor Optimization now supports DNS overriding. For our customers, you can find the DNS override setting in the “Advanced” tab, under “Browser Configuration.” WebPageTest is another popular, open source tool that supports DNS overriding. You can use WebPageTest’s setDNS and setDNSName scripting functions or use the “SPOF” tab when starting a test to automatically override DNS to point to blackhole.webpagetest.org.

Interested in super specific performance optimizations like SPOF testing and DNS Overrides? Then you will love Rigor’s performance monitoring and optimization platform. Our continuous monitoring provides 24/7 performance visibility of your website’s performance and availability and can identify hundreds of performance defects that are slowing it down. To learn more about Rigor’s web performance products, contact us today.

Suggested Blog Posts