Open Bug 1417221 Opened 7 years ago Updated 21 days ago

Prevent background thumbnails from causing high CPU usage

Categories

(Toolkit :: General, enhancement, P3)

enhancement

Tracking

()

Performance Impact low
Tracking Status
firefox59 --- affected

People

(Reporter: Mardak, Unassigned)

References

Details

(Keywords: perf, perf:resource-use, power)

Bug 1412505 had a temporary fix to ignore twitch.tv, so it doesn't cause high CPU when its javascript fails to load <video> in the background thumbnail context, which sets `docShell.allowMedia = false;`

Ideally a more general solution can be used for any site that would have caused high CPU.

A broad `docShell.allowJavascript = false` is undesired as many pages probably require javascript for a nice looking thumbnail.

Potentially Firefox can be reactive and learn that thumbnailing certain sites cause high CPU and dynamically blacklists.

Alternatively, some way in preventing the javascript from using up so much CPU could work too. Although unclear exactly what twitch.tv is doing. (My initial guess is the <video> element triggered some event that resulted in a retry that then repeats immediately.)
Priority: -- → P3
Whiteboard: [qf][fxperf]
Keywords: power
Whiteboard: [qf][fxperf] → [qf][fxperf:p3]
Whiteboard: [qf][fxperf:p3] → [qf:p1][qf:f64][fxperf:p3]
Whiteboard: [qf:p1][qf:f64][fxperf:p3] → [qf:p1:f64][fxperf:p3]
Re-queuing for triage by fxperf to reconcile with qf evaluation.
Whiteboard: [qf:p1:f64][fxperf:p3] → [qf:p1:f64][fxperf]
Mike, do you remember how this became a qf:p1 a month ago? Without profiles or an indication of how common this is in the wild, it's hard to make this more than fxperf:p3.
Flags: needinfo?(mconley)
(In reply to Florian Quèze [:florian] from comment #2)
> Mike, do you remember how this became a qf:p1 a month ago? Without profiles
> or an indication of how common this is in the wild, it's hard to make this
> more than fxperf:p3.

If I remember correctly, the problem is general enough that we felt like profiles were probably not worth while (since what we're talking about here is potentially expensive websites that users visit being visited again, but in the background). So I think this was made qf:p1 looking for a general solution where we could showhow throttle down the CPU that the thumbnailer uses, or more aggressively bail out of screenshotting pages that take too much time or computing power to gather.
Flags: needinfo?(mconley)
This doesn't seem very actionable in the short term, but yes it's important. I'm hoping that the ongoing work to add performance counters (bug 1419681) will be somehow reusable for this purpose.
Whiteboard: [qf:p1:f64][fxperf] → [qf:p1:f67][fxperf:p3]

Hey florian, are today's performance counters any closer to being usable for the thumbnailer to detect bad actor pages?

Flags: needinfo?(florian)
Whiteboard: [qf:p1:f67][fxperf:p3] → [qf:p3:resource][fxperf:p3]

I don't know if the performance counters are accessible to the thumbnailer code, but they most likely exist already, so if it's not available it would just be a matter of adding the required plumbing. Do you think we are likely to have someone who would want to work on this soon? If so, asking Tarek how to access the counters (or how to get started) would be the next step.

Flags: needinfo?(florian)
Performance Impact: --- → P3
Whiteboard: [qf:p3:resource][fxperf:p3] → [fxperf:p3]
Severity: normal → S3
Whiteboard: [fxperf:p3]
You need to log in before you can comment on or make changes to this bug.