Closed Bug 803575 Opened 12 years ago Closed 12 years ago

[Native Fennec] Expire tabs based on LRU and age

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 19

People

(Reporter: kats, Assigned: kats)

References

Details

(Whiteboard: [MemShrink])

Attachments

(1 file, 1 obsolete file)

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.
(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).
Attached patch Patch (obsolete) — Splinter Review
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 :)
Attached patch Patch (v2)Splinter Review
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/mozilla-central/rev/5981344041a1
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → Firefox 19
Whiteboard: [MemShrink]
Summary: Turn on tab expiration → [Native Fennec] Expire tabs based on LRU and age
Blocks: 816381
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: