akamai / boomerang

End user oriented web performance testing and beaconing
http://akamai.github.io/boomerang/
Other
1.86k stars 292 forks source link

Fix: Continuity high TTI values reported (mostly when c.tti gets leaked to other type of beacon) #311

Closed sukratkashyap closed 3 years ago

sukratkashyap commented 4 years ago

Hi Team,

Related partially on: https://github.com/akamai/boomerang/issues/248 https://github.com/akamai/boomerang/issues/245

What we want

We want c.tti to be calculated accurately on the page load beacon (spa_hard or undefined initiators).

Cases it fails:

Unpredictable cases:

Predictable cases: According to our code, the assumption of the value of c.tti is:

VisuallyReady < c.tti < (page_ready + waitAfterOnLoad)

We try to calculate c.tti after page_ready is fired and for waitAfterOnLoad ms. After which we send page load beacon without c.tti. (Since our assumption equation didn't work for some users)

Now, If afterOnLoad=true

c.tti is possible to be attached to any type of beacon, especially when it fails at page_load. But then the c.tti values reported are very high and very unreliable. I know it's anyways not a good idea to trust them. But this PR tries to somewhat rectify that issue.

Scenario

Fix

nicjansma commented 3 years ago

@sukratkashyap this is a really great explanation and idea. Thank you for putting this together.

So if I'm understanding correctly, one of the major changes here is it makes it so idleIntervals isn't needed to be re-calculated every time as we keep track of the bucketsVisited to kind-of restart the calculation where we left off.

Have you thought about what a test might look like for this? It would be a little complex (and might have a few phases), but I think we could do it with a combination of some of the existing continuity tests plus waiting a bit after onload for the TTI to actually happen.

I don't see any other major concerns with the code. If you have time to build tests for this, that would be great, otherwise we can try to tackle them soon.

nicjansma commented 3 years ago

@sukratkashyap Thank you again for this PR. I've merged these changes and a few others suggested in https://github.com/akamai/boomerang/issues/315, into a new PR https://github.com/akamai/boomerang/pull/326, and have refactored things a bit so it can be unit-test covered.

I'm going to close out this PR, but I've noted your contributions in the other PR.

Thank you!