Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core(config): switch to lantern by default, add presets #5041

Merged
merged 13 commits into from
May 3, 2018

Conversation

patrickhulce
Copy link
Collaborator

@patrickhulce patrickhulce commented Apr 25, 2018

Changes

  • converts the default throttling method to lantern 'simulate'
  • reduces the default network quiet/cpu quiet to 1000ms, this is a bit less aggressive than our old original values but still much improved, and we could increase this if needed, but the full 5s should definitely be unnecessary
  • replaces --perf and --mixed-content with --preset=perf/mixed-content, there's been some opposition to this before, it wouldn't be incredibly laborious to keep so lmk
  • old defaults are runnable with --throttling-method=devtools

Yet to Change

The perfy smoke tests made some assumptions about the network/CPU quiet thresholds that don't hold up anymore, so left those testing the devtools path for now and will update those as I finish up the opportunity parity, on the plus side rest of smoketest time went from ~100s to ~80s :)

Also left the golden LHR diffing on observed for now to reduce the noise, seems like we'll want to be checking both in our tests anyhow once there's 100% parity?

config = mixedContentConfig;
// The mixed-content audits require headless Chrome (https://crbug.com/764505).
cliFlags.chromeFlags = `${cliFlags.chromeFlags} --headless`;
} else if (cliFlags.configPreset) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about just --preset :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wfm, @brendankenny ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--preset

yeah, I think it reads well in context

@@ -6,7 +6,7 @@
'use strict';

module.exports = {
extends: 'lighthouse:default',
extends: 'lighthouse:observed',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the "observed" name refers to observed things (metrics, etc), regardless of throttling method.

Since this config is primarily about changing throttling method I would have expected a name like 'throttled'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started out with devtools as the name but the primary value of this thing existing is having the 5s+ wait times in the defaultPass which applies to all observed methods. It does indeed change the throttlingMethod as well, but that's easily done without presets/extension. throttled overly communicates the value in changing the throttling IMO, i.e. why would I want --preset=throttled --throttlingMethod=off/provided?

The most consistent might be to make observed not actually apply the throttling by default, and require --throttlingMethod=devtools but that seems to discourage throttling which isn't great.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just think its confusing that observedMetrics all exist outside of the lighthouse:observed config.

better question: when is observed used? for --preset=perf and for the ttci smoketest, right? why doesn't ttci smoke just use/extend perf config?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree that observed is a little confusing here. It does sound like it's fairly neutral, observed regardless of throttling method, but if I was told it affected the throttling method I would guess it was closer to none, not using devtools throttling.

But it sounds like you may be rearranging things, so maybe I'll wait to comment further :)

@@ -187,7 +188,7 @@ function deepClone(json) {
// injection of plugins.
if (Array.isArray(json.passes)) {
cloned.passes.forEach((pass, i) => {
pass.gatherers = cloneArrayWithPluginSafety(json.passes[i].gatherers);
pass.gatherers = cloneArrayWithPluginSafety(json.passes[i].gatherers || []);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happened here? Don't we require at least an empty array in the passes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well IMO, we shouldn't and the new defaults for passes make sure it's at least an empty array, but that doesn't work with the cloning, I can revert if you feel strongly all passes should declare empty gatherers.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I think that makes sense in the extending case, if I'm reading your response correctly. Can you make gatherers optional in the LH.Config.PassJson side of things, then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍

@@ -6,7 +6,7 @@
'use strict';

module.exports = {
extends: 'lighthouse:default',
extends: 'lighthouse:observed',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree that observed is a little confusing here. It does sound like it's fairly neutral, observed regardless of throttling method, but if I was told it affected the throttling method I would guess it was closer to none, not using devtools throttling.

But it sounds like you may be rearranging things, so maybe I'll wait to comment further :)

@patrickhulce
Copy link
Collaborator Author

OK ready for re-review I believe! no more observed config or extension, config.js just forces the defaultPass quiet thresholds to 5.25s+ if the throttling method is devtools or provided

@patrickhulce patrickhulce changed the title core(config): switch to lantern by default, add config-preset core(config): switch to lantern by default, add presets May 1, 2018
@patrickhulce
Copy link
Collaborator Author

friendly ping here, review please! :)

const defaultPass = config.passes.find(pass => pass.passName === 'defaultPass');
if (!defaultPass) return;

defaultPass.pauseAfterLoadMs = Math.max(5250, defaultPass.pauseAfterLoadMs);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels like this 5250 magic number should be defined in constants.js

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call done

@@ -60,7 +60,7 @@
"changelog": "conventional-changelog --config ./build/changelog-generator/index.js --infile changelog.md --same-file",
"type-check": "tsc -p .",
"update:sample-artifacts": "node lighthouse-core/scripts/update-report-fixtures.js -G",
"update:sample-json": "node ./lighthouse-cli -A=./lighthouse-core/test/results/artifacts --output=json --output-path=./lighthouse-core/test/results/sample_v2.json http://localhost/dobetterweb/dbw_tester.html && node lighthouse-core/scripts/cleanup-LHR-for-diff.js ./lighthouse-core/test/results/sample_v2.json --only-remove-timing",
"update:sample-json": "node ./lighthouse-cli -A=./lighthouse-core/test/results/artifacts --throttling-method=devtools --output=json --output-path=./lighthouse-core/test/results/sample_v2.json http://localhost/dobetterweb/dbw_tester.html && node lighthouse-core/scripts/cleanup-LHR-for-diff.js ./lighthouse-core/test/results/sample_v2.json --only-remove-timing",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doing this to avoid the mixed settings error, right?
next run of update-report-fixtures will be throttling-method: 'simulate', right?

so a followup PR to update both makes sense to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but speaking of. perhaps we should also have 1 golden LHR for simulate and 1 for throttled. Feels like we have a blind spot otherwise.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also left the golden LHR diffing on observed for now to reduce the noise, seems like we'll want to be checking both in our tests anyhow once there's 100% parity?

totally agree ;)

@patrickhulce
Copy link
Collaborator Author

if everyone is afraid of this one we should get it in sooner rather than later to iron out the kinks ;)

@@ -63,7 +63,7 @@ const SMOKETESTS = [{
id: 'offline',
expectations: 'offline-local/offline-expectations.js',
config: smokehouseDir + 'offline-config.js',
batch: 'parallel-second',
batch: 'offline',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulirish I made this change after too many flakes on travis, now that things aren't throttled it seems too much is trying to happen at once and at least one navstart was getting dropped on ~70% of runs :(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aiight.

@@ -63,7 +63,7 @@ const SMOKETESTS = [{
id: 'offline',
expectations: 'offline-local/offline-expectations.js',
config: smokehouseDir + 'offline-config.js',
batch: 'parallel-second',
batch: 'offline',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aiight.

@@ -60,8 +60,15 @@ const defaultPassConfig = {
gatherers: [],
};

const observedPassConfigOverrides = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throttledPassConfigDefaults
or
nonSimulatedPassConfigOverrides

if (!defaultPass) return;

const overrides = constants.observedPassConfigOverrides;
defaultPass.pauseAfterLoadMs =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wouldn't yell bloody murder if you renamed this to dPass or something to avoid all the wrapppppppppppppppping

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh, yeah I spent more time than I should to save this one, basically nothing saves the last one (triple networkQuietThresholdMs is just too much` so I gave up, at least here it's consistent and easy to understand

@paulirish
Copy link
Member

🍫 😋

@brendankenny brendankenny self-assigned this May 3, 2018
Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a few things, otherwise looking good!

@@ -187,7 +188,7 @@ function deepClone(json) {
// injection of plugins.
if (Array.isArray(json.passes)) {
cloned.passes.forEach((pass, i) => {
pass.gatherers = cloneArrayWithPluginSafety(json.passes[i].gatherers);
pass.gatherers = cloneArrayWithPluginSafety(json.passes[i].gatherers || []);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I think that makes sense in the extending case, if I'm reading your response correctly. Can you make gatherers optional in the LH.Config.PassJson side of things, then?

return;
}

const defaultPass = config.passes.find(pass => pass.passName === 'defaultPass');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hopefully in the future we can make a way to tell if it's a metric-measuring pass (similar to gather-runner's hacky isPerfRun) rather than just the default pass, but not sure how to solve the problem if you want to do metric-measuring and have your own thresholds here that are less than the defaults...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that makes sense, I suppose we could do it on all useThrottling passes as a proxy?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed offline, it's an impl detail of TTI that we need 5s+ which is hardcoded to defaultPass so we're sticking to defaultPass for now 👍

@@ -28,7 +28,8 @@ trap teardown EXIT

colorText "Generating a fresh LHR..." "$purple"
set -x
node "$lhroot_path/lighthouse-cli" -A="$lhroot_path/lighthouse-core/test/results/artifacts" --quiet --output=json --output-path="$freshLHRPath" http://localhost/dobetterweb/dbw_tester.html
# TODO(phulce): add a lantern LHR-differ
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should do this soon

@@ -58,7 +58,6 @@ Configuration:
CHROME_PATH: Explicit path of intended Chrome binary. If set must point to an executable of a build of
Chromium version 54.0 or later. By default, any detected Chrome Canary or Chrome (stable) will be launched.
[default: ""]
--perf Use a performance-test-only configuration [boolean]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need presets and other new changes here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -22,7 +21,7 @@ const log = require('lighthouse-logger');
window.runLighthouseForConnection = function(
connection, url, options, categoryIDs,
updateBadgeFn = function() { }) {
const config = options && options.fastMode ? new Config(fastConfig, options.flags) : new Config({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where was this set before? I can't find it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's just set by lightrider, all runs for them will be simulated now anyway

});

assert.equal(config.settings.throttlingMethod, 'devtools');
assert.ok(config.passes[0].pauseAfterLoadMs >= 5000, 'did not adjust load quiet ms');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add assertion that this is defaultPass? And maybe a test (or modify this test) with more categories so it can check other passes aren't affected

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@patrickhulce
Copy link
Collaborator Author

@brendankenny LGTY?

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@brendankenny
Copy link
Member

ju9dxm5

@patrickhulce patrickhulce merged commit a6dbd1a into master May 3, 2018
@patrickhulce patrickhulce deleted the lantern_default branch May 3, 2018 21:36
kdzwinel pushed a commit to kdzwinel/lighthouse that referenced this pull request Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants