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(lantern): use fixed times for data URLs #9932

Merged
merged 2 commits into from
Nov 7, 2019
Merged

Conversation

patrickhulce
Copy link
Collaborator

@patrickhulce patrickhulce commented Nov 6, 2019

Summary
Special cases non-network protocols in simulator similar to how we special case cached responses. Net effect on our checked-in data overall was minimal (moving just 1 URL from OK to Good).

Funniest effect was a 15 second increase to the pessimistic TTFCPUI where the data URL time was just over the threshold before but now that we shortened it to a few ms that quiet window closed and now FCPUI comes after the second wave of activity instead 😆 everything else was very small movement.

Related Issues/PRs
closes #9833


beforeAll(async () => {
it('should compute a timeInMs', async () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cleaned this up because it made looking at just one test with .only impossible during development

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.

Funniest effect was a 15 second increase to the pessimistic TTFCPUI where the data URL time was just over the threshold before but now that we shortened it to a few ms that quiet window closed and now FCPUI comes after the second wave of activity instead 😆

That's amazing

@@ -7,6 +7,7 @@

const BaseNode = require('./base-node.js');
const NetworkRequest = require('../network-request.js');
const URL = require('../url-shim.js');
Copy link
Member

Choose a reason for hiding this comment

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

We've got to rename this thing at some point

/**
* @return {boolean}
*/
get isNonNetworkProtocol() {
Copy link
Member

Choose a reason for hiding this comment

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

What's up with all getters in this file? Kind of weird :)

// 2ms per request + 10ms/MB
// @see traces on https://dopiaza.org/tools/datauri/examples/index.php
const sizeInMb = (record.resourceSize || 0) / 1024 / 1024;
timeElapsed = 2 + 10 * sizeInMb - timingData.timeElapsed;
Copy link
Member

Choose a reason for hiding this comment

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

Is this low compared to @paulirish's 10-15ms suggestion?

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 but I couldn't find evidence to support that much overhead on some test pages and 10-15 seemed too high compared to our read from disk estimates, @paulirish do you have any docs we could link to to support 10-15ms?

happy to use whatever we have clear evidence of

Copy link
Member

Choose a reason for hiding this comment

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

happy to use whatever we have clear evidence of

I'd guess that @paulirish was ballparking, too, so let's call this good and we can revisit later if somehow these end up giving us bizarre lantern graphs or something (seems very unlikely :)

Copy link
Member

Choose a reason for hiding this comment

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

yah was just ballparking. I went looking in UMA yesterday but couldnt spot a relevant histogram.

Seems fine for now. 👍

* @return {boolean}
*/
get isNonNetworkProtocol() {
return URL.NON_NETWORK_PROTOCOLS.includes(this._record.protocol);
Copy link
Member

Choose a reason for hiding this comment

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

Is it useful to reuse this here vs making a new list here? There are some non network protocols we wouldn't include here (presumably eg intent wouldn't end up as a node, but this list might expand in the future)

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'm not sure when this would actually need to diverge from our canonical set, so I'd prefer to reuse. It's true it will include things we don't actually need to test but I doubt the reverse will ever be true

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!

const simulator = new Simulator({serverResponseTimeByOrigin});
const result = simulator.simulate(nodeA);

// should be ~2ms for A, ~12ms for B
Copy link
Member

Choose a reason for hiding this comment

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

for clarity for future tinkerers, maybe

Suggested change
// should be ~2ms for A, ~12ms for B
// should be ~2ms for A (resourceSize 0), ~12ms for B (resourceSize 1MB)

...or else a comment up on the node creation lines calling out the resourceSize?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lantern: data uris include server response time
4 participants