Ajax Performance
A blog by Ryan Breen of Gomez
If you are reading this post, you are contributing to a benchmark
November 19, 2006 on 10:06 pm | In ajax |In several earlier posts, I talked about the increasing migration of complexity to the edges of the network, to within the web browser. Today, tools to manage and understand that complexity and how it relates to real user experience don’t really exist, and that’s a problem we have been thinking about for the past year or so.
We realized that the best way to understand what is happening inside the end user’s browser is to be inside the end user’s browser, so we are building a JavaScript based technology, dubbed Actual Experience XF, which does just that. I previewed this approach during my presentation at the Ajax Experience, but now I’m finally allowed to demonstrate it publicly.
An early demo, which I am calling Actual Experience Lite until my marketing department punches me in the head, is available at aelite.ajaxperformance.com. To instrument a page for collection of metrics, you first include a small .js file in HEAD. Out of the box, the tag will track the DOM Ready and onload times as well as additional metadata (browser type and version number, etc).
The tag also provides 3 JavaScript functions — nameEvent, startInterval, and endInterval — which can be used to add timing instrumentation anywhere within your client side code. The first, nameEvent, defines a point-in-time event, while the latter two are used to measure a span of time. Here’s a simple use case:
var xhReq = createXMLHttpRequest();
xhReq.open("GET", "someGet.aspx?giveMe=stuff&iWant=stuff", true);
xhReq.onreadystatechange = onSomeResponse;
startInterval('some request');
xhReq.send(null);
function onSomeResponse() {
if (xhReq.readyState != 4) { return; }
endInterval('some request');
var serverResponse = xhReq.responseXML;
// do a bunch of stuff with the xml response
nameEvent('finished response parsing');
}
This example would create two events: an interval event called ’some request’ with a start time and a duration, and a point in time event called ‘finished response parsing’ with a start time and no duration. All start times are relative to the load of the aelite.js tag.
Code samples are all well and good, but real world data is what keeps my 3 readers coming back. In the hopes of providing a valuable service to the community, I instrumented a copy of the W3C vs. innerHTML table building benchmark from quirksmode. I embedded my aelite-ified benchmark as a hidden iframe in the footer of this blog, so any visit to any page contributes to the benchmark. Results are available here.
I’m hoping that the aggregation of hits over time from a variety of browsers will give us a more meaningful understanding of the costs of different scripting techniques, and I will use this platform to build a suite of interesting benchmarks over time. Suggestions are always welcome, of course.
All of the graphs are created client side by Dojo Chart, packaged as a kitchen-sink build plus either the svg (Mozilla/Opera) or vml (IE) packages. The charting page itself uses aelite, so any visit to a chart page is also a contribution to a benchmark of Dojo Chart. Since the Dojo libs [can] have a very robust girth (350kB or thereabouts [when packaged in a completely unoptimized fashion for the purposes of establishing a worst-case benchmark]), I instrumented the charting page to measure the time it takes for the browser to parse the entire dojo-[svg,vml].js. I also added an interval measurement around the render time for the chart. It will be interesting to watch performance trends as I track new Dojo releases.
I will be at Web Builder 2.0 in Las Vegas, December 4-6, presenting on the 5th and conducting a full day workshop on the 6th. The workshop will include hands on labs covering the instrumentation approach, so I plan to have many more samples available in the coming weeks.
[Update] I have replaced the dojo-[svg,vml].js with a single dojo.js provided by Alex Russell. It includes both renderers and is less than half the size of my previous build. Feel free to pound away at the charting to give us some nice comparison data ![]()
10 Comments »
RSS feed for comments on this post. TrackBack URI
Leave a comment
Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds.
Valid XHTML and CSS. ^Top^
I don’t understand the number very well.
The first number is suppored to be the start. The start of what? It’s hard to beleive that some start time is 0 and on other is 5 seconds?
I guess I don’t understand what I’m seeing.
Comment by James — November 20, 2006 #
Start time is relative to the loading of aelite.js. The first stanza action performed by aelite is the setting of the start timestamp. Any event that happens in the page is timed against this start, so a start of 0 means that effectively no clock time passed between executing aelite.js and executing the first timer.
Comment by Ryan Breen — November 20, 2006 #
Ryan: If you’re interested in real-world Dojo performance, why are you using a kitchen sink build for these tests? You can construct builds that match your use case much better and won’t cost so much. It’s frustrating to see a “benchmark” of Dojo that sets it up to fail when I’m sure you know that we provide tools for optimizing the very metrics that you’re looking at.
Regards
Comment by Alex Russell — November 20, 2006 #
Alex, I started a kitchen sink build for expediency and to set a worst case baseline for performance. My intention was not to set Dojo up to fail but to see how code changes or packaging optimizations impact performance.
Even with such a ham-fisted approach, performance is actually very good, with a parse time of 55ms and a render time of 180ms, across all browsers.
I will update the site with a more optimized lib, and I clarified the language of the original post to claim more responsibility for the ‘robust girth.’
Ryan
Comment by Ryan Breen — November 20, 2006 #
Ryan: Thanks for the clarification. Let me know if I can be of assistance in getting you a build for use on your charting page.
Regards
Comment by Alex Russell — November 20, 2006 #
Alex,
Any help would certainly be appreciated, and I will gladly replace my current build with an optimized build you provide, if it’s not too much trouble.
My goal was to package all necessary code into a single .js to reduce network round tripping, and I believe that this requires a separate build for svg and vml as the two appear to be mutually exclusive. Does this approach make sense?
Ryan
Comment by Ryan Breen — November 20, 2006 #
Ryan: kinda. The network round-trip optimization only makes sense up to a point. Frankly, given the small number of files that are going to be “specialized” and given that they’re gonna be cached, I’d make a build that includes everything up to, but not including, the svg/vml code. Yes, you’ll still have one or two sync XHR calls to get the others, but I think you’ll find it just much simpler a setup to maintain.
I’ll send you a build that does this in private mail.
Regards
Comment by Alex Russell — November 20, 2006 #
[...] As I’ve posted previously, collecting Ajax performance information directly within the browser is compelling and provides a level of insight that simply isn’t available with other techniques. It’s great to see so much focus on Ajax-aware performance testing these days. [...]
Pingback by Ajax Performance » WebWait — February 14, 2007 #
[...] Frequent readers will recall that, a few months ago, I built a performance instrumentation package which supported the collection and aggregation of performance metrics from inside an end user’s browser. Timings are communicated up to a Rails app at aelite.ajaxperformance.com and graphed client side using the Dojo Chart widget. [...]
Pingback by Ajax Performance » Click a link, help a worthy cause — April 4, 2007 #
[...] in the prototype Rails client side perf tool I used for Dojo Charts measurements (and a couple of other projects), and it’s also the approach used by [...]
Pingback by Ajax Performance » Client side performance testing has arrived — June 25, 2008 #