Support warmload tests under --browsertime
Categories
(Testing :: Raptor, enhancement, P2)
Tracking
(firefox71 fixed)
Tracking | Status | |
---|---|---|
firefox71 | --- | fixed |
People
(Reporter: nalexander, Assigned: tarek)
References
(Blocks 2 open bugs)
Details
Attachments
(1 file)
Out of the box, browsertime supports cold pageload tests. This ticket tracks extending to warm pageload tests. The way this works in browsertime is that one runs a Selenium Node.js script to drive the additional loads.
nalexander and acreskey both have versions of this.
Updated•5 years ago
|
Reporter | ||
Comment 1•5 years ago
|
||
Tarek: it's probably worth implementing this so that we can run more cycles, more quickly, while we align the two harnesses. (Otherwise we wait a long time for each cold load run to start.)
Locally this runs through a Node.js script, like:
// From https://github.com/acreskeyMoz/browsertime_tools/blob/ecde1ad8f55fdbc6be95188481951f05a07aaa85/reload.js.
module.exports = async function(context, commands) {
let url = context.options.perftest.url;
let reloads = context.options.perftest.reloads;
await commands.measure.start(url, 'cold load');
// According to the docs you need to prepend a dummy parameter to test the same page in browsertime:
// https://www.sitespeed.io/documentation/sitespeed.io/scripting/
let dummy = url.indexOf('?') == -1 ? '/?dummy' : '&dummy';
for (let count = 0; count < reloads; count++) {
await commands.wait.byTime(3000);
await commands.measure.start(url + dummy + count, 'reload' + count);
}
return true;
};
Then we'll do something like
bin/browsertime.js ... warmload.js --perftest.url='https://example.com' --perftest.reloads=5
I haven't tested this locally in a long, long time so you'll have to investigate.
Notes:
- Raptor has
browser_cycles
andpage_cycles
. This will bepage_cycles
. - Bonus points for handling both browser and page cycles.
- You can differentiate coldload from warmload with
test.get('cold')
. - I expect that result processing will need to accommodate differently shaped
browsertime.json
due to only having one Browsertime invocation with multiple results in the single run.
Reporter | ||
Comment 2•5 years ago
|
||
I believe that the dummy parameters interfere with Necko caching, but I'm not aware of what the best option is here. acreskey, do you have an opinion on what we should do for warmload testing?
Reporter | ||
Updated•5 years ago
|
Comment 3•5 years ago
•
|
||
I'm not sure why the sitespeed.io documentation says "testing the same site multiple times will break".
I had started off with the dummy url method but I'm sure it does break Necko caching and it does indeed produce a differently-shaped browsertime.json
which isn't great.
So I went to a method that's closer to what Denis was using:
(Transcribed here with the automation variables)
module.exports = async function(context, commands) {
let url = context.options.perftest.url;
let reloads = context.options.perftest.reloads;
await commands.navigate('https://www.example.com');
await commands.wait.byTime(30000); // magic number
// Initial cold load and wait
await commands.navigate(url);
await commands.wait.byTime(10000); // magic number
// Warm loads
for (let count = 0; count < reloads; count++) {
await commands.wait.byTime(3000); // magic number
await commands.measure.start(url);
}
return true;
};
This one is throwing away the results of the cold load.
The browsertime.json
shape is identical to the cold load, so the process.py
and R scripts all work out of the box.
Assignee | ||
Comment 4•5 years ago
|
||
Support warmload tests under --browsertime
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 5•5 years ago
|
||
Nick, here's a minimal diff that runs multiple page cycles and grabs them in the results - seems to work. I think we can have a single bt script for both cold/warm tests, but we should talk about it before I go further here.
Updated•5 years ago
|
Assignee | ||
Comment 6•5 years ago
|
||
Comment 8•5 years ago
|
||
bugherder |
Comment 10•5 years ago
|
||
I must have made a mistake in Comment 3 -- although that script works for warm loads the shape of the json is quite different.
The cold load format has all the iterations within the first element's browserscripts.
This warm load format creates new root elements for each warm load.
Denis, did you happen to have a warm load script that gives browsertime.json
in the same shape as the default cold loads?
I was experimenting with the measure command but wasn't successful.
Updated•3 years ago
|
Description
•