DailyJS

Measuring Performance with Boomerang

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

tutorials performance

Measuring Performance with Boomerang

Posted by Alex R. Young on .
Featured

tutorials performance

Measuring Performance with Boomerang

Posted by Alex R. Young on .

Boomerang by the Exceptional Performance team at Yahoo! is a way of measuring site performance from a visitor's point
of view. It can measure roundtrip time, bandwidth and latency.

Roundtrip measurements are the total time it takes to initiate a
resource request to the point at which it is completely available. This
is implemented by using event handlers on window.onunload
and window.onload. The unload handler takes
the time in milliseconds and stores it in a cookie, with the URL of the
page. The onload event then compares the current time to
the one in the cookie, or attempts to use the Web
Timing
API.

Timers can be associated with the entire page load time, or each
resource within it.

Measuring Bandwidth and Latency

Use git to download the code into a suitable location on your web
server:

cd /var/www/my_site/
git clone http://github.com/yahoo/boomerang.git

Then create a test HTML page like this one: gist:
458518
.

The important piece of code here is this:

BOOMR.init({
  user_ip: '10.0.0.1'
});

On a production site, the base_url would probably be a
full path to where you keep boomerang -- perhaps you have a separate
server for static files. The authors recommend setting the IP address
using server-side scripts.

The BOOMR.subscribe('before_beacon', ...) code is used
instead of a remote beacon to print bandwidth and latency statistics.
It'll take a few seconds to display the stats after loading the page.

Other Use Cases

The Boomerang documentation has a full set of use cases with code
samples: Use cases for
boomerang
.

The API
documentation
is
fairly easy to follow too.