Project 256meg and tab zombification



All timestamps are based on your local time of:

Posted by: stak
Tags: mozilla
Posted on: 2012-11-02 15:27:48

The main thing that I'm working on these days is "Project 256meg" (aka bug 792131). The goal of the project, as the name implies, is to get Fennec working well on phones with only 256 MiB of memory. There are a large number of older ARMv6 Android devices out there which have less than the 512 MiB of memory that we currently require for Fennec. Having Fennec run well on these devices would allow all of those people to use it as well.

One of the changes I landed recently was to "zombify" tabs under certain conditions. Zombifying a tab unloads the content loaded in the tab, thereby freeing up most of the memory associated with that tab. The tab itself remains, and remembers the URL it was on, so that when the user switches to it, it will resurrect itself by re-loading the content. The behaviour is quite similar to what Android itself does with activities - it will close activities in the background silently if needed, and open them again if the user switches back to them.

In bug 784040 we added code that zombifies all of the background tabs when we get a low-memory event from the system. In bug 792143 and bug 803575, we added some additional conditions to zombify individual tabs to prevent excessive memory usage before it happens. Specifically, when a new tab is opened, the least-recently-used background tab is zombified, if it hasn't been used in some amount of time (controlled by the browser.tabs.expireTime pref; defaults to 1 hour; -1 to disable). This behaviour is enabled by default on low-memory devices and is turned on dynamically on high-memory devices after we receive the first low-memory event on those devices.

I'm planning to also add some telemetry to see how often these events get triggered in practice, so that we can tune the behaviour as we go. However if you feel like your tabs are getting turned into zombies too often for your liking, let me know (either file a bug or comment here) and we can investigate.

Posted by Merike at 2012-11-02 16:26:42
Is it known how many of these older phones support OpenGL ES 2.0? This requirement prevents even phones having a bit more memory than 256MB running Fennec :(
[ Reply to this ]
Posted by stak at 2012-11-02 20:06:51
Not all of them, it's true. However there are still a good chunk of phones that do support OpenGL ES 2.0 and have less than 512 MiB of memory. There's not a lot of hard data out there, but a lot of the globally "most popular Android phones" fall into this category.

Relaxing the OpenGL ES 2.0 requirement is unfortunately going to be pretty hard given how we've implemented Fennec.

Update: According to http://developer.android.com/about/dashboards/index.html around 91% of devices support GLES 2.0.
[ Reply to this ]
Posted by Taras at 2012-11-02 17:34:52
This is cool work.
[ Reply to this ]
Posted by Jigar shah at 2012-11-02 18:34:02
Cool....I thought Mozilla cares about those 30% with high end mobile :) I am eagerly waiting for FF on my motorola charm :)
Name:
Comment:
Allowed expansions in comments/replies: [i]italic[/i], [u]underline[/u], [b]bold[/b], [code]code[/code], [sub]subscript[/sub], [sup]superscript[/sup], [url=http://some.url]linked text[/url]
Human verification: Sum of forty-one and twenty-one =
Posted by Manoj Mehta at 2012-11-02 21:08:01
Can this land for the desktop browser as well? This along with load tabs on demand would make a huge difference in Firefox's memory usage, which will go a long way towards mending FF's reputation of being a memory hog.

Additionally, unloading background tabs will ensure that any Flash content on background tabs does not slow down the foreground/most recently used tabs.

Manoj
[ Reply to this ]
Posted by stak at 2012-11-03 10:00:46
That's an excellent point! I'll file a bug and bring it up at the next MemShrink meeting. Thanks for the suggestion!

Update: filed bug 808293
[ Reply to this ]
Posted by Tomer Cohen at 2012-11-03 11:53:47
I wanted to request the same, but please keep in mind that some people would prefer to have this feature turned off by default.

Some people use the web to steam audio to their speakers while surfing on other tabs. If we will freeze their audio streaming tab without prior notification, they may use another browser which won't kill background tabs.

Another use case is sites such as Facebook, Gmail and Twitter which periodically reload data from the server in order to show notifications to the user. I think that for these sites it'd be best if we could somehow prioritize background threads (Web Workers) so instead of having the whole site fully functional we could turn off only idle threads.
[ Reply to this ]
Posted by stak at 2012-11-03 19:16:58
Yeah we'll definitely take that into account. Things like app tabs will probably never get unloaded; we'll likely have heuristics to determine what can and can't be unloaded.
[ Reply to this ]
Posted by Jigar Shah at 2012-11-03 11:32:19
Another question..what's minimum android version being targeted for ARMv6 build ?
[ Reply to this ]
Posted by stak at 2012-11-03 19:17:18
Same as for the ARMv7 build - Android 2.2 will be the minimum version supported.
[ Reply to this ]

[ Add a new comment ]

 
 
(c) Kartikaya Gupta, 2004-2014. User comments owned by their respective posters. All rights reserved.
You are accessing this website via IPv4. Consider upgrading to IPv6!