Closed Bug 2028789 Opened 7 months ago Closed 22 days ago

Ressources could be better throttled to the client

Categories

(DevTools :: Framework, enhancement, P3)

enhancement

Tracking

(firefox161 fixed)

RESOLVED FIXED
161 Branch
Tracking Status
firefox161 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

(Blocks 1 open bug, Regressed 1 open bug)

Details

Attachments

(1 external file)

The throttling logic used by the server codebase is imperfect.
We would typically notify the client about a single ressource because aggregating all the following ones.
That's because of this code:
https://searchfox.org/firefox-main/rev/98bf4b92d3f5d7a9855281df4bf333210bcfbbc4/devtools/shared/throttle.js#42-51

const remaining = wait - (now - previous);
args = arguments;
if (remaining <= 0) {
  if (!isWorker) {
    clearTimeout(timeout);
  }
  timeout = null;
  previous = now;
  result = func.apply(scope, args);
  args = null;

Throttling would consider that an old call to the method justify calling the original method right away, whereas we should probably have a little bounce period to try to aggregate any (possibly synchronous) closely following call!

The patch will introduce a new throttling mixing a first bouncing phase, to aggregate calls after a "calm period" followed by a throttling one.

While it fixes issues with some tests not resolving correctly because of ressources being notified in multiple throttled aggregates (like in bug 2023681), it is hard to guess from DAMP what could be a relevant setting for bouncing and throttling durations.

tl;dr; 10ms bounce 100ms throttle may be a good default?

Assuming a 100ms throttle (same as today)

Comparing between 10ms and 25ms bounce:
25ms regress console-log-in-content while it improved panels in background.

Comparing between 25 and 50ms bounce:
it looks like 50ms regress a few things while improving console-log-in-content ones.

Comparing between 10 and 0ms bounce)
Moving to 0 seems to regress a couple of reload test while improve random others

Comparing different throttlings

Comparing 100 to 200ms) regress performances (with a 0 bounce)

It also regresses from 100 to 200 with a 50ms bounce)

This help aggregate the first ressources which may have dispatched
right away whereas some others could be delivered synchronously right after.

Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED

Moving most untriaged internal task / enhancements to P3

Priority: -- → P3

There is an r+ patch which didn't land and no activity in this bug for 2 weeks.
:ochameau, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(poirot.alex)
Flags: needinfo?(nchevobbe)
Flags: needinfo?(nchevobbe)
Blocks: 2085888
Pushed by apoirot@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/3adc28c3cedf https://hg.mozilla.org/integration/autoland/rev/63965810a335 [devtools] Bounce and throttle ressources. r=devtools-reviewers,nchevobbe,jdescottes
Flags: needinfo?(poirot.alex)
Status: ASSIGNED → RESOLVED
Closed: 22 days ago
Resolution: --- → FIXED
Target Milestone: --- → 161 Branch
Regressions: 2088466
QA Whiteboard: [qa-triage-done-c162/b161]
Regressions: 2091324
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: