Automated time-to-interactive measurement

Pierre Dubouilh
Greta.io
Published in
2 min readSep 25, 2017

After watching last week’s talk by Ben Schwarz at NordicJS (slides) on real-life web performance, we decided to release a small script we used internally; here comes tti-measure.

At Greta we constantly seek for better web-performance, and measuring a realistic figure regarding end-user web-page performance is crucial for us.

It used to be somewhat difficult, with lots of different metrics available (DOMContentLoaded, onLoad). And that’s where time-to-interactive comes to save the game, as it provides a really realistic metric on websites performance. The tti is measured when the page is ready, usable, and when there were no long JS tasks for the past 5 seconds (cf. calibre docs for more explanation).

It still relies on new web API, so it’s only really usable on Chrome at the moment, with the help of a polyfill.

tti-measure consists of a simple tool, that runs the website you provide on chrome, injects the JS necessary to measure the tti, and measure the metric. It runs the site multiple times, and through different network profiles (3g, dsl), so you can be assured your website is realistically fast, even on bumpier connections.

Because we can’t live without CI, it’s very easy to implement it on a CI platform, just have a look at the travis file in the repo. It runs on sane default settings (different network profiles, exit 1 if the tti is over 5 seconds), but it’s fully customizable for your needs/market.

Have a look, the code is on our github repo, and the install is just one command away: npm i -g tti-measure

Greta.io is dedicated to helping users increase site performance with an innovative approach to content delivery. We use machine learning to make content routing decisions in the client based on real-time network data. For every piece of content, Greta automatically decides if the content should be delivered over multi-CDN, peer-to-peer, client cache or an overlay network. As a result, customers experience shorter content load times, higher content quality and server offload during peak traffic.

--

--