Firefox is chewing through your NAND

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

keybored

Active Member
May 28, 2016
280
66
28
If you're a Firefox user, you may find this to be of interest.

Purely by chance, I fired up a free copy of SSDLife on two consecutive days where I haven't really used my workstation for anything other than email and browsing. For those of you unfamiliar with this tool, it simply reports estimated lifetime for the attached SSD and it also shows the amount of data read and written.

In my case, SSDLife notified me that 12GB was written to the SSD in one day. Since I didn't recall downloading any huge files over the previous day or visiting any new sites that could've resulted in bringing down a lot of new content to the cache, this puzzled me. I monitored these stats over the next couple of weeks and this behavior stayed consistent. Even if the workstation was left idle with nothing running on it but a few browser windows, it would invariably write at least 10GB per day to the SSD.

To find out what's going on, I fired up Resource Monitor and looked at disk utilization.

firefox-disk-writes.jpg

At the very top of the list was Firefox, writing tirelessly at anywhere between 300K and 2MB per second to a file called "recovery.js". Googling around revealed that this is Firefox's session backup file that is used to restore your browser sessions in case of a browser or an OS crash. I was aware of the fact that Firefox had this feature, but I had no idea that session information was so heavy!

After some digging, I found out that this behavior is controlled by a parameter that you can access through "about:config" -- browser.sessionstore.interval
It is set to 15 seconds by default. In my case, I reset it to a more sane (at least for me) 30 minutes. Since then, I'm only seeing about 2GB written to disk when my workstation is left idle, which still feels like a lot but is 5 times less than before.

Bottom line is that if you have consumer level SSDs in some of your machines, you may want to check and tweak your Firefox config. Those things are usually rated for about 20GB of writes per day and Firefox alone might be using more than half of that, especially if you're like me and have a few browser windows open at all times each with numerous tabs. Changing this parameter may even help with normal HDDs. Your machine will feel faster if it doesn't have to constantly write this session info.
 

NetWise

Active Member
Jun 29, 2012
596
133
43
Edmonton, AB, Canada
Good find. 15 seconds sounds pretty frequent. I wonder if Chrome does the same.

However on even a 120gb drive at 0.3 DWPD, you're still wonder the 36gb.

This is one of those things I regularly have to remind people about things like virtualized backups and changed blocks - it's not always how much NEW data you write, if you're changing bits inside of files, etc. Most people don't catch this kind of stuff because there's no 'growth' of data just rewrites


Sent from my iPhone using Tapatalk
 

capn_pineapple

Active Member
Aug 28, 2013
356
80
28
"about:config" -- browser.sessionstore.interval
It is set to 15 seconds by default. In my case, I reset it to a more sane (at least for me) 30 minutes. Since then, I'm only seeing about 2GB written to disk when my workstation is left idle, which still feels like a lot but is 5 times less than before.
Good find. 15 seconds sounds pretty frequent. I wonder if Chrome does the same.
Awesome Find!!! Yeah, interested if chrome does the same thing, this could be a game changer in the office.
 

EffrafaxOfWug

Radioactive Member
Feb 12, 2015
1,394
511
113
You sure the numbers are right on this...? I use Pale Moon (firefox fork so does pretty much the same thing), out of the box my portable install has the interval set to 60,000 i.e. 60s) and I don't see anything near throughput of 10GB/day.

The sessionstore.js of my current session is 600kB - even if the whole file were written out in entirety every 15s that's still only:
0.6MB x 4 = 2.4MB per hour
2.4MB x 24 = ~60MB per day

Obviously only backing up once a minute or so reduces this proportionally further.

Is this just because I've got an inordinately small sessionstore.js (browsing session has only been running for a few days). The only heavy disc activity I see when browsing is mostly writes to the places.sqlite database.

Edit: aha, it seems there's a "new and improved" session restore introduced in FF33 which, as seems to be the case here, is inordinately expensive on IO.
 
  • Like
Reactions: tukoz

keybored

Active Member
May 28, 2016
280
66
28
...

However on even a 120gb drive at 0.3 DWPD, you're still wonder the 36gb.

...
Yeah, I think the number I mentioned (20GB/day) is a bit outdated at this point. It would appear that modern consumer drives are closer to the 50-60GB/day mark if you go purely by the rated endurance divided by the number of warranty years. So, an extra 10GB/day won't kill them but will probably affect the resale value, for those that care about it. After 3 years you'll probably get a few bucks less for a consumer drive that has 10TB extra data written to it. For me, it's more of a control thing. I don't like my equipment doing things I didn't authorize it to do. :)
 

keybored

Active Member
May 28, 2016
280
66
28
...

Edit: aha, it seems there's a "new and improved" session restore introduced in FF33 which, as seems to be the case here, is inordinately expensive on IO.
I should have mentioned the version I'm using -- 48.0.2. Definitely have the numbers right since I monitored the situation over a couple of weeks. The I/O impact will also depend on how many windows and tabs you have open at one time. I was getting 12GB/day when I had 4 FF windows open each with 15-20 tabs. After I closed all but one window and left about 15 tabs open, the number went down to ~10GB/day.
 

EffrafaxOfWug

Radioactive Member
Feb 12, 2015
1,394
511
113
Aye, from reading the ghacks article they seem to have gone for a vastly overcomplicated solution to the problem of the session restores becoming corrupted (not an issue I've run into in years thankfully), rather than actually fixing the root cause and stopping the files becoming corrupted...

I typically only have the one window but 50-500 tabs open (one of the reasons I started using PM in the first place was that FF frequently made this absolutely impossible) but as said, my session state files don't seem to be that big. How big are users' typical recovery.js files...?
 

Marsh

Moderator
May 12, 2013
2,644
1,496
113
My FF version is 48.0.2
2 FF windows with about 10 tabs. My recovery.js is about 500k.
I shutdown my desktop before bedtime 9pm , and startup around 6:30am when I am at my desktop.
 

Fritz

Well-Known Member
Apr 6, 2015
3,372
1,375
113
69
Is there a way to disable session restore entirely? Seems like there used to be but the setting isn't there anymore.
 

Patrick

Administrator
Staff member
Dec 21, 2010
12,511
5,792
113
Does it matter what type of tabs you have open? E.g. if I have a 2000+ page switch PDF in a tab does that get saved every interval?
 

keybored

Active Member
May 28, 2016
280
66
28
Is there a way to disable session restore entirely? Seems like there used to be but the setting isn't there anymore.
browser.sessionstore.resume_from_crash looked promising, but I didn't notice any change in disk activity after I flipped it to "false". It might require a browser restart, which I haven't tried. Or it may simply control whether you get that prompt after a crash.
 

keybored

Active Member
May 28, 2016
280
66
28
Does it matter what type of tabs you have open? E.g. if I have a 2000+ page switch PDF in a tab does that get saved every interval?
It should only save session related information. A PDF viewer might not have a whole lot of data to save. Maybe the page you're on or recent searches.
I opened a couple of new windows with some random cell phone and SSD reviews in them as well as a bunch of youtube tabs with paused videos and that seems to be generating a good amount of data.
 

keybored

Active Member
May 28, 2016
280
66
28
... How big are users' typical recovery.js files...?
Started at 2MB when I came back home today. I had one window open with 12 tabs. Opened 2 extra windows with 12-16 tabs in each one and the file is up to 4MB in size now. Writes in Resource Monitor are consistent, never go away, and fluctuate from 200KB/s to 2MB/s without me doing absolutely anything in any of the browser windows. The browser just sits there writing all this data out.
 

DavidRa

Infrastructure Architect
Aug 3, 2015
329
152
43
Central Coast of NSW
www.pdconsec.net
As a data point, I have a single browser window and about 15 tabs, some with static content and others with stuff that's a bit more dynamic. Recovery.js for me is just 98kB:

Code:
20/09/2016  12:59 PM            98,343 recovery.js
I am also on version 48.02 on this computer.
 

T_Minus

Build. Break. Fix. Repeat
Feb 15, 2015
7,625
2,043
113
Turning off session restore in FF would make it pointless to use... FF crashes so often :eek:
 
  • Like
Reactions: NetWise

keybored

Active Member
May 28, 2016
280
66
28
Found an interesting correlation... it would appear that this behavior is triggered by Outlook. May be the case with other web mail sites too but don't have another account to verify. On a totally different machine, opened three windows with about 10 tabs each and watched for activity. While there was some, it didn't look like the stuff I was seeing on my workstation where there is a continuous stream of writes in Resource Monitor. Added a new tab with Outlook mail in it and the same thing started happening. Will have to redo this a couple more times to make sure this wasn't a fluke.
 

DavidRa

Infrastructure Architect
Aug 3, 2015
329
152
43
Central Coast of NSW
www.pdconsec.net
Found an interesting correlation... it would appear that this behavior is triggered by Outlook. May be the case with other web mail sites too but don't have another account to verify. On a totally different machine, opened three windows with about 10 tabs each and watched for activity. While there was some, it didn't look like the stuff I was seeing on my workstation where there is a continuous stream of writes in Resource Monitor. Added a new tab with Outlook mail in it and the same thing started happening. Will have to redo this a couple more times to make sure this wasn't a fluke.
Do you have OWA configured for local/offline storage, perchance?