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(network-analyzer): fix num of roundtrips for h3 estimates #15102

Merged
merged 2 commits into from
May 24, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions core/lib/dependency-graph/simulator/network-analyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ class NetworkAnalyzer {

// Assume everything before sendStart was just DNS + (SSL)? + TCP handshake
// 1 RT for DNS, 1 RT (maybe) for SSL, 1 RT for TCP
let roundTrips = 2;
let roundTrips = 1;
if (!record.protocol.startsWith('h3')) roundTrips += 1; // TCP
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 add this logic to TTFB as well.

WDYT about adding some kind of getRoundTripCount helper function to NetworkRequest so that we don't have to maintain this in 3 different places?

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 a bit more complicated than first glance to share this code, since the analyzer has its own concept of "is this connection reused?". I can try in a followup.

if (record.parsedURL.scheme === 'https') roundTrips += 1;
return timing.sendStart / roundTrips;
});
Expand Down Expand Up @@ -227,8 +228,8 @@ class NetworkAnalyzer {
// TTFB = DNS + (SSL)? + TCP handshake + 1 RT for request + server response time
if (!connectionReused) {
roundTrips += 1; // DNS
if (!record.protocol.startsWith('h3')) roundTrips += 1; // TCP
if (record.parsedURL.scheme === 'https') roundTrips += 1; // SSL
roundTrips += 1; // TCP handshake
}

// subtract out our estimated server response time
Expand Down