[Native Fennec] Expire tabs based on LRU and age

RESOLVED FIXED in Firefox 19

Status

()

Firefox for Android
General
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: kats, Assigned: kats)

Tracking

unspecified
Firefox 19
All
Android
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [MemShrink])

Attachments

(1 attachment, 1 obsolete attachment)

We need to figure out if/when to turn on the tab expiration added in bug 792143. Some possible options:

1) Pref it on for all ARMv6 builds at compile-time
2) Pref it on for low-memory devices at run-time (assuming bug 801818 is fixed)
3) Wait until we hit a low-memory situation at runtime and then turn it on
4) Some combination of the above
5) Other?
my preference would be for #3. I think taras would prefer having it on all the time (for battery consumption rather than memory), CC'ing him.

Comment 2

5 years ago
(In reply to Brad Lassey [:blassey] from comment #1)
> my preference would be for #3. I think taras would prefer having it on all
> the time (for battery consumption rather than memory), CC'ing him.

I think #3 is a good start, can investigate more aggressive approaches once #3 lands.
Agreed that #3 is a good start. It would be nice if we could make this a session-only pref. I mean, each time we'd start a new Firefox, we'd start _not_ expiring tabs. We could do that by setting the "default branch" version of the preference:

let defaults = Services.prefs.getDefaultBranch();
defaults.setIntPref(...);

Such a pref value is only retained while Firefox is running and is reset to the real default value upon restart.

Food for thought.
Was discussing this with Brad today, and I want to clarify the existing behaviour and exactly what this bug is for.

Currently:
1) we unconditionally zombify all background tabs when we get a memory-pressure event (this was added in bug 784040)
2) time-based tab zombification (added in bug 792143) is completely disabled

"Time-based tab zombification", if enabled, will trigger zombification of a zero or one tabs when a new tab is opened. The tab that is zombified is the least-recently-used tab, if and only if the tab hasn't been used for browser.tabs.zombieTime seconds.

This bug is about when to enable "time-based tab zombification". My preference is to turn it on by default for low-memory devices, and to turn it on after receiving the first memory-pressure event on high-memory devices. I can add another boolean check or pref control exactly when the behaviour is enabled, if needed (or I could try to do it using the "default branch" of the pref as mark suggested).
Created attachment 674830 [details] [diff] [review]
Patch

This patch (1) assumes that my patch from bug 801818 is in the tree and (2) calls the new behaviour "pre-emptive zombies" because i suck at coming up with good names for things. Suggestions welcome, but I'll wait on requesting review until bug 801818 is actually landed.
Assignee: nobody → bugmail.mozilla
You could refer to this action as "tab expiration" (you filed it that way) and use:
Tabs._enablePreemptiveZombies -> Tabs._enableExpiration
browser.tabs.zombieTime -> browser.tabs.expirationTime

I'm fine with zombies too, so up to you :)
Created attachment 677088 [details] [diff] [review]
Patch (v2)
Attachment #674830 - Attachment is obsolete: true
Attachment #677088 - Flags: review?(mark.finkle)
Comment on attachment 677088 [details] [diff] [review]
Patch (v2)

Looks like a good start. Would telemetry probes for expiring tabs be useful to help us see how often the code is executing?
Attachment #677088 - Flags: review?(mark.finkle) → review+
(In reply to Mark Finkle (:mfinkle) from comment #8)
> Looks like a good start. Would telemetry probes for expiring tabs be useful
> to help us see how often the code is executing?

Good call, I've filed bug 808003 as a follow-up for that.
https://hg.mozilla.org/integration/mozilla-inbound/rev/5981344041a1
https://hg.mozilla.org/mozilla-central/rev/5981344041a1
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → Firefox 19
Whiteboard: [MemShrink]

Updated

5 years ago
Summary: Turn on tab expiration → [Native Fennec] Expire tabs based on LRU and age

Updated

5 years ago
Blocks: 816381
You need to log in before you can comment on or make changes to this bug.