Friday, December 21, 2012

WaitN and HTTPWatch – Latency Measurements using Automated UI Testing

I wanted the measure the latency of a website from different geo locations. Some of the calls were made by JavaScript and hence UI actions were required instead of a simple playback of HTTP requests.
So there were two major goals
  1. Automating the UI actions
  2. Capturing the HTTP traces for these actions
There are a lot of options available for UI automation but it was important that the framework I chose is compatible with the toll I use to capture the HTTP traces.
 
So the first task was to determine which tool to be used for capturing the traces. The tool needed to have the ability of starting the trace. Stopping the trace and saving the trace in an automated fashion. HTTPWatch comes to rescue here. The basic edition is available for free but you will need to buy a license for advanced operations. See http://www.httpwatch.com/
 
Now, I had to determine an UI automation framework which works seamlessly with HTTPWatch. WaitN (pronounced as What-In) can be used with HTTPWatch. There is a sample available on the HTTPWatch site, see http://blog.httpwatch.com/2008/10/30/using-httpwatch-with-watin/
 
I wrote a console app using WatiN and HTTPWatch and could run it from different geo locations to collect the results. Sweet!

Wednesday, December 19, 2012

SQL / SSRS - Selecting 95% and 99% (percentile) values

I was trying to generate a SSRS report where I wanted to display the 95% and 99% (percentile) values to remove the outliers.
Unfortunately there isn't a percentile function in SSRS unlike excel.

So I had to use SQL to derive these values.

To derive 95% value, select top 5% by ordering the counters of the instance in desc order. Now order these 5% in ascending order and select top 1
Select @95P = (select top 1 t.coulmnname from (select top 5 percent coulmnname from tablename order by columnname desc)t order by t.coulmnname asc)

To derive 99% value, select top 1% by ordering the counters of the instance in desc order. Now order these 1% in ascending order and select top 1
Select @99P = (select top 1 t.coulmnname from (select top 1 percent coulmnname from tablename order by columnname desc)t order by t.coulmnname asc)

Thursday, December 6, 2012

Fiddler - Simulate Modem Speeds


There is an easy trick in Fiddler to simulate modem speeds. You can go to Rules->Performance->Simulate Modem Speeds to enable it.
It can also be customized by going to Rules->Customize Rules
This will open CustomRules.js where you will find
if (m_SimulateModem) {
            // Delay sends by 300ms per KB uploaded.
            oSession["request-trickle-delay"] = "300";
            // Delay receives by 150ms per KB downloaded.
            oSession["response-trickle-delay"] = "150";
        }
The values for request-trickle-delay and response-trickle-delay can be modified as per your need.

Now make a request in browser to experience the delay