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(speedindex): scale coefficients according to throttling #7007

Merged
merged 2 commits into from
Jan 15, 2019

Conversation

patrickhulce
Copy link
Collaborator

@patrickhulce patrickhulce commented Jan 14, 2019

Summary
This PR makes it possible to scale the lantern coefficients based on the throttling settings. Previously the desktop LR preset was giving too pessimistic estimates on Speed Index because of the hardcoded 1.4x multiplier on the observed speed index.

Key Example Fix (facebook.com)

Before
image

After
image

Related Issues/PRs
fixes #6971

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! Just some ideas for the comments

@@ -42,6 +42,19 @@ class LanternMetricArtifact {
throw new Error('COEFFICIENTS unimplemented!');
}

/**
* Scale the coefficients according to the throttling settings.
Copy link
Member

Choose a reason for hiding this comment

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

maybe "Returns the coefficients, scaled by the throttling settings if needed by the metric. Some lantern metrics..." (or something like that) since this is more or less the proper way to retrieve this.COEFFICIENTS now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍 sg

"pessimistic": 1631,
"timing": 1657,
}
`);
Copy link
Member

Choose a reason for hiding this comment

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

lol

static scaleCoefficients(rttMs) { // eslint-disable-line no-unused-vars
// We want to multiply our default coefficients based on how much farther from baseline our
// new throttling settings are compared to the defaults.
// We will use a baseline of 30 ms RTT (where Speed Index should be a ~50/50 blend of optimistic/pessimistic).
Copy link
Member

Choose a reason for hiding this comment

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

this description is a little confusing. One attempt at rewording: We want to scale our default coefficients based on the speed of the connection. We will linearly interpolate coefficients for the passed-in rttMs based on the baseline points of 30 ms RTT (where Speed Index should be a ~50/50 blend of optimistic/pessimistic) and the default throttled RTT (where Speed Index should be the default-coefficient blend of optimistic/pessimistic).

Copy link
Member

Choose a reason for hiding this comment

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

Also can you add a note about how this scale was derived/can be re-derived if defaults change in the future? It's not clear why you'd expect 50/50 mix at 30ms and then be what you'd expect between there and the default point and beyond :)

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!!

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.

❤️ it

@brendankenny brendankenny merged commit 82819a0 into master Jan 15, 2019
@brendankenny brendankenny deleted the speed_index_coefficients branch January 15, 2019 18:00
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.

SpeedIndex not accurate with non-standard Lantern settings
2 participants