Closed Bug 449124 Opened 16 years ago Closed 14 years ago

Continuous Places activity while idle reduces laptop battery life

Categories

(Firefox :: Bookmarks & History, defect, P2)

3.0 Branch
defect

Tracking

()

RESOLVED WORKSFORME
Firefox 4.0b9

People

(Reporter: ast, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Keywords: regression)

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.1) Gecko/2008071718 Firefox/3.0.1 Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.1) Gecko/2008071718 Firefox/3.0.1 Firefox 3.0.1 does continuously modify places.sqlite and places.sqlite-journal while tabs are open and the browser is otherwise idle (tcpdump shows no firefox related activity). This happens at irregular intervals of a few minutes, usually at least once within five minutes. This prevents the use of disk spin down on laptops and thus causes reduced battery life. A sample of the changed values in the database from "diff -u" is given below: -INSERT INTO "moz_places" VALUES(2583,'http://www.heise.de/newsticker/Ohrenschmaus-Koelner-Orgelkonzert-live-in-Berliner-Hightech-Hoersaal-erleben--/meldung/113107','heise online - Ohrenschmaus: Kölner Orgelkonzert live in Berliner Hightech-Hörsaal erleben','ed.esieh.www.',1,0,0,115,70); +INSERT INTO "moz_places" VALUES(2583,'http://www.heise.de/newsticker/Ohrenschmaus-Koelner-Orgelkonzert-live-in-Berliner-Hightech-Hoersaal-erleben--/meldung/113107','heise online - Ohrenschmaus: Kölner Orgelkonzert live in Berliner Hightech-Hörsaal erleben','ed.esieh.www.',1,0,0,115,50); -INSERT INTO "moz_places" VALUES(2635,'http://archives.free.net.ph/message/20080709.121701.1b869479.en.html','[Openswan dev] Fwd: unkown symbol ipsec_nat_encap while insert ipsec.ko','hp.ten.eerf.sevihcra.',1,0,0,NULL,70); +INSERT INTO "moz_places" VALUES(2635,'http://archives.free.net.ph/message/20080709.121701.1b869479.en.html','[Openswan dev] Fwd: unkown symbol ipsec_nat_encap while insert ipsec.ko','hp.ten.eerf.sevihcra.',1,0,0,NULL,50); -INSERT INTO "moz_places" VALUES(5578,'http://linux.derkeiler.com/Mailing-Lists/Kernel/2007-09/msg00883.html','Re: Linux, 2.6.23-rc5, powersaving degradation, (time spend in C0 goes up after a while)','moc.reliekred.xunil.',1,0,0,471,100); +INSERT INTO "moz_places" VALUES(5578,'http://linux.derkeiler.com/Mailing-Lists/Kernel/2007-09/msg00883.html','Re: Linux, 2.6.23-rc5, powersaving degradation, (time spend in C0 goes up after a while)','moc.reliekred.xunil.',1,0,0,471,70); -INSERT INTO "moz_places" VALUES(5766,'http://mosh.nokia.com/search?find=map24&x=0&y=0','MOSH by Nokia','moc.aikon.hsom.',1,0,0,762,100); +INSERT INTO "moz_places" VALUES(5766,'http://mosh.nokia.com/search?find=map24&x=0&y=0','MOSH by Nokia','moc.aikon.hsom.',1,0,0,762,70); This means that the frecency entries of moz_places is modified. This modification should only be done when the browser becomes active e.g. when a wb page is reloaded. Reproducible: Always Don't update on disk data when there is apparently no need to do so to preserve laptop battery life and to allow disk spin down.
The solution is to set places.frecency.updateIdleTime to 0 in about:config according to http://kb.mozillazine.org/Places.frecency.updateIdleTime but this is asking too much from the average user. Either this behaviour and the solution to is should be documented in a prominent place and in a way for the average user to understand, or the default value for places.frecency.updateIdleTime should become 0. As an alternative a GUI preference like "laptop mode" which sets this value and any future values that cause disk activity and consume idle CPU should be created that allows an average user to easily change to the desired firefox behaviour.
Severity: normal → minor
I'm guessing the frequent computation and database updates are necessary because of the use of "buckets" (http://developer.mozilla.org/en/docs/The_Places_frecency_algorithm). What if the value of a visit decayed continuously (e.g. 3% per day) instead? Then the total value could be stored as "the time at which the value was or will be 100" and no updating would be necessary except upon a new visit.
Keywords: perf
confirming but i don't think is actually a perf bug and also affecting other OS. The actual idea IIRC is to move those kind of calculations in a background thread rather than on idle.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: perf
OS: Linux → All
Hardware: PC → All
Summary: continuous update of frecency in moz_places of places database → Continuous update of frecency in idle reduces laptop battery life
I'll take this
Assignee: nobody → sdwilsh
Blocks: 428565
Severity: minor → normal
Status: NEW → ASSIGNED
Depends on: 429988
Flags: blocking-firefox3.1?
Target Milestone: --- → Firefox 3.1
=> major, since it blocks a bug marked major
Severity: normal → major
Please do not change the importance of bugs not assigned to you.
Severity: major → normal
Priority: -- → P2
Shawn, notice we could use bug 431558 that has a timer to do work in background actually.
(In reply to comment #2) > I'm guessing the frequent computation and database updates are necessary > because of the use of "buckets" > (http://developer.mozilla.org/en/docs/The_Places_frecency_algorithm). What if > the value of a visit decayed continuously (e.g. 3% per day) instead? Then the > total value could be stored as "the time at which the value was or will be 100" > and no updating would be necessary except upon a new visit. filed bug 458801 for this. we expire history on idle as well, so morphing this bug to cover all of places.
Summary: Continuous update of frecency in idle reduces laptop battery life → Continuous Places activity while idle reduces laptop battery life
Not going to hold the 3.1 release for this. For 3.2, we should consider pursuing Jesse's idea in bug 458801.
Flags: blocking-firefox3.1? → blocking-firefox3.1-
Sounds right. It's fair to say this activity constitutes a regression from FF2. And it didn't hit me until just now that this could explain why my laptop is hotter even while plugged in.
Keywords: regression
Version: unspecified → 3.0 Branch
It would be nice if Gecko had APIs that interfaced to the OS to tell us whether or not we're running on battery. Since there isn't currently such a thing, Thunderbird uses the nsINetworkLinkSerivce as a proxy for this in some cases (eg if there's no network link, one is reasonably likely to be on battery, so we avoid doing certain indexing stuff in that case).
(In reply to comment #11) > It would be nice if Gecko had APIs that interfaced to the OS to tell us whether > or not we're running on battery. Since there isn't currently such a thing, > Thunderbird uses the nsINetworkLinkSerivce as a proxy for this in some cases > (eg if there's no network link, one is reasonably likely to be on battery, so > we avoid doing certain indexing stuff in that case). You are looking for bug 454660
Depends on: 454660
Assignee: sdwilsh → nobody
Target Milestone: Firefox 3.1 → Future
Target Milestone: Future → Firefox 3.2a1
Depends on: 476254
It is absurd that this is not elevated to a much higher priority. This bug, as noted in the dependent bug 428565, prevents laptops running OS X (if not other OS's) from sleeping when FF 3.0.x is running. It does seem pretty reasonable that this bug should be marked at least major given that it is blocking Bug 428565.
Bug 458801 tracks how we're adjusting Places to estimate frecencies instead of continuously picking some places and recalculating frecencies over and over again on idle. In terms of recalculation, it does some work at most once a day on idle where it does a mass recalculation of valid frecencies by decaying them by .975 which results in .5 the original value after 28 days. Also, it recalculates invalid (negative) frecencies at that time as well. The bug doesn't address how we expire history or move things from temp tables on idle though.
Depends on: 458801
Status: ASSIGNED → NEW
Bug 451915 - move Firefox/Places bugs to Firefox/Bookmarks and History. Remove all bugspam from this move by filtering for the string "places-to-b-and-h". In Thunderbird 3.0b, you do that as follows: Tools | Message Filters Make sure the correct account is selected. Click "New" Conditions: Body contains places-to-b-and-h Change the action to "Delete Message". Select "Manually Run" from the dropdown at the top. Click OK. Select the filter in the list, make sure "Inbox" is selected at the bottom, and click "Run Now". This should delete all the bugspam. You can then delete the filter. Gerv
Component: Places → Bookmarks & History
QA Contact: places → bookmarks
Apart activities that run once (and just once) when idle starts, that should not be considered a problem imo (because here the problem is continuous activity), most likely the only task remaining on Minefield is nsPlacesDBFlush that runs to ensure database consistency. Once we will kill temp tables it will go away, that will happen when LAZY_ADD will be dead, and we will have sqlite 3.7.0, that has a new interesting journaling mode that should greatly reduce fsyncs).
Depends on: 552023
Ideally Places now (after the branch merge) should be much better at managing batteries. On idle we do some cleanup work, but then we stop any operation till we come back. DBFlush component has also been removed. I think leaving this open does not bring any positive effect, if any particular cause of battery consumption is found in a specifi component or code, it should be filed as a separate bug.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
Target Milestone: Firefox 3.6a1 → Firefox 4.0b9
http://shawnwilsher.com/archives/473 describes the recent Places changes that should reduce power waste.
You need to log in before you can comment on or make changes to this bug.