Determining Network Time in Watir Scripts

By this I mean I wanted to determine how much network and server time was spent processing a request initiated by a Watir script. Server time as defined by time to first buffer and network time as time to last buffer (minus the first).

I couldn’t really do this from Ruby itself, so I installed Fiddler. Fiddler lets you capture traffic in much the same way as ethereal / wireshark but with a nice GUI. There are some Fiddler customization scripts which let you display this info in the Custom column i.e.
oSession["ui-customcolumn"] = "FB: " + oSession["X-TTFB"] + "; LB: " + oSession["X-TTLB"];

But if you’re a neat freak like me and want them in separate columns then do this:

public static BindUIColumn("Time")
function CalcMethodCol1(oS: Session){
if (null != oS.oRequest) return DateTime.Now.ToString("dd/MM/yy HH:mm:ss.ffff");
else return String.Empty;
}

public static BindUIColumn("AbbreviatedUrl")
function CalcMethodCol2(oS: Session){
if (null != oS.oRequest) return oS.url.substring(oS.url.lastIndexOf("/"));
else return String.Empty;
}

public static BindUIColumn("TTFBuffer")
function CalcMethodCol3(oS: Session){
if (null != oS.oResponse) return oS["X-TTFB"];
else return String.Empty;
}

public static BindUIColumn("TTLBuffer")
function CalcMethodCol4(oS: Session){
if (null != oS.oResponse) return oS["X-TTLB"];
else return String.Empty;
}

You place them before you declare the static function OnBeforeRequest. The time stamp used above ends up being the ‘end’ timestamp, not the ‘start’ so you just need to subtract time to last buffer to determine that. You end up with this in your summary view:
ttfb.png

Once this is done you can pretty up the results by copying the ‘Full Summary’ for your selected sessions in Fiddler and pasting them into Excel. This was the main reason for doing this. If you’re happy with the Fiddler ‘timeline’ view then you don’t need to bother. I just wanted the data so I could merge/correlate with other data sources.
gantt.png

Would be interested to know if anyone has achieved this in ruby itself. I was thinking of using the webrick/httpproxy but would have come short if testing a HTTPS web app.

Read More

Gantt Charts in Open Office

This might help you out when analyzing time series data.

In this particular situation I’m looking at a bunch of SOA web services that get called synchronously in the backend infrastructure. The logs have entries with a unix timestamp, service description and duration. What I want to do is view the data in a Gantt Chart format. This link from Microsoft put me on the right track.

Here’s how to do it in Open Office.

Read More

Microsoft Log Parser to the Rescue

I hate to say it… but Microsoft really have produced an excellent tool for sysadmins and performance testers alike. That tool is called LogParser. I’ve mentioned it before but that was more IIS specific. LogParser can be pointed at just about any type of log file. So with a bit of Perl (or equivalent) to cleanup, and LogParser I was able to analyze Gigabytes of IBM WebSEAL access logs on a production system.

Read More