1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Firefox is chewing through your NAND

Discussion in 'Software Stuff' started by keybored, Sep 18, 2016.

  1. keybored

    keybored Active Member

    Joined:
    May 28, 2016
    Messages:
    173
    Likes Received:
    41
    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.
     
    #1
  2. NetWise

    NetWise Active Member

    Joined:
    Jun 29, 2012
    Messages:
    572
    Likes Received:
    118
    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
     
    #2
  3. capn_pineapple

    capn_pineapple Active Member

    Joined:
    Aug 28, 2013
    Messages:
    266
    Likes Received:
    62
    Awesome Find!!! Yeah, interested if chrome does the same thing, this could be a game changer in the office.
     
    #3
  4. NetWise

    NetWise Active Member

    Joined:
    Jun 29, 2012
    Messages:
    572
    Likes Received:
    118
    I wonder what the IOPS requirements are for this. This would make a big difference in a VDI environment...


    Sent from my iPhone using Tapatalk
     
    #4
  5. EffrafaxOfWug

    EffrafaxOfWug Radioactive Member

    Joined:
    Feb 12, 2015
    Messages:
    359
    Likes Received:
    128
    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.
     
    #5
    tukoz likes this.
  6. keybored

    keybored Active Member

    Joined:
    May 28, 2016
    Messages:
    173
    Likes Received:
    41
    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. :)
     
    #6
  7. keybored

    keybored Active Member

    Joined:
    May 28, 2016
    Messages:
    173
    Likes Received:
    41
    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.
     
    #7
  8. EffrafaxOfWug

    EffrafaxOfWug Radioactive Member

    Joined:
    Feb 12, 2015
    Messages:
    359
    Likes Received:
    128
    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...?
     
    #8
  9. NetWise

    NetWise Active Member

    Joined:
    Jun 29, 2012
    Messages:
    572
    Likes Received:
    118
    50 to 500 tabs???


    Sent from my iPhone using Tapatalk
     
    #9
    Mike-EEE likes this.
  10. Marsh

    Marsh Well-Known Member

    Joined:
    May 12, 2013
    Messages:
    1,011
    Likes Received:
    360
    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.
     
    #10
  11. Fritz

    Fritz Well-Known Member

    Joined:
    Apr 6, 2015
    Messages:
    1,475
    Likes Received:
    273
    Is there a way to disable session restore entirely? Seems like there used to be but the setting isn't there anymore.
     
    #11
  12. Patrick

    Patrick Administrator
    Staff Member

    Joined:
    Dec 21, 2010
    Messages:
    8,947
    Likes Received:
    2,622
    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?
     
    #12
  13. keybored

    keybored Active Member

    Joined:
    May 28, 2016
    Messages:
    173
    Likes Received:
    41
    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.
     
    #13
  14. keybored

    keybored Active Member

    Joined:
    May 28, 2016
    Messages:
    173
    Likes Received:
    41
    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.
     
    #14
  15. keybored

    keybored Active Member

    Joined:
    May 28, 2016
    Messages:
    173
    Likes Received:
    41
    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.
     
    #15
  16. DavidRa

    DavidRa Infrastructure Architect

    Joined:
    Aug 3, 2015
    Messages:
    205
    Likes Received:
    87
    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.
     
    #16
  17. T_Minus

    T_Minus Moderator

    Joined:
    Feb 15, 2015
    Messages:
    5,109
    Likes Received:
    927
    Turning off session restore in FF would make it pointless to use... FF crashes so often :eek:
     
    #17
    NetWise likes this.
  18. keybored

    keybored Active Member

    Joined:
    May 28, 2016
    Messages:
    173
    Likes Received:
    41
    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.
     
    #18
  19. DavidRa

    DavidRa Infrastructure Architect

    Joined:
    Aug 3, 2015
    Messages:
    205
    Likes Received:
    87
    Do you have OWA configured for local/offline storage, perchance?
     
    #19
  20. keybored

    keybored Active Member

    Joined:
    May 28, 2016
    Messages:
    173
    Likes Received:
    41
    Nope, "Turn on offline access" is unchecked...
     
    #20
Similar Threads: Firefox chewing
Forum Title Date
Software Stuff Question about Firefox browser.sessionstore setting Oct 29, 2016

Share This Page