39

iotop -a (accumulated I/O) on Linux shows after about 10 min. of browsing Internet:

Total DISK READ:       0.00 B/s | Total DISK WRITE:       0.00 B/s               
  TID  PRIO  USER     DISK READ DISK WRITE>  SWAPIN      IO    COMMAND           
17330 be/4 wojdyr     1540.00 K     38.48 M  0.00 %  0.00 % firefox              
  403 be/3 root          0.00 B     31.65 M  0.00 %  0.06 % [jbd2/sda5-8]        
17276 be/4 wojdyr      800.00 K     31.06 M  0.00 %  0.00 % firefox              
17329 be/4 wojdyr        0.00 B     20.96 M  0.00 %  0.00 % firefox              
31896 idle wojdyr        0.00 B   1200.00 K  0.00 %  0.00 % virtuoso-~.ini +wait 
31924 be/4 wojdyr        0.00 B   1064.00 K  0.00 %  0.00 % akonadi_n~ail_feeder 
18959 be/4 wojdyr        0.00 B    796.00 K  0.00 %  0.01 % firefox

I'm quite surprised by the amount of data written to disk. I turned off to-disk caching, but it didn't make notable difference. I turned off block-reported-attack-sites/web-forgeries -- nothing changed.

Is this rate of writing to disk normal in Firefox (10.0.1)? It quickly exceeds the total size of my firefox profile.

Looking at modification times of files in the firefox profile I see that a few files are modified very often:

cookies.sqlite{-wal,-shm}
sessionstore.js
places.sqlite{-wal,-shm}
permissions.sqlite

Is there something wrong with my system or configuration, or is it typical for FF?

I don't like this pointless writing to (SSD) disk. Can I do something about it?

EDIT: I've found this guide how to relocate the entire Firefox profile to RAM. It reduced almost to zero data written by firefox during session. (I know this is a bit paranoid and probably not worth the hassle.)

5
  • 7
    I think you are too concerned with the write limit of SSDs. Unless it is a first gen SSD, your laptop will die before the SSD does.
    – surfasb
    Mar 11, 2012 at 19:06
  • You are right. I know I there is no reason to worry so much about this disk, but I can't help it :-)
    – marcin
    Mar 12, 2012 at 17:41
  • I know this is an old question but it's what came up when I googled. For me, I found that the Web Of Trust (WOT 20150708) add-on for Firefox was writing to disk 38.8 KB every second. So I disabled the add-on. Jul 13, 2015 at 21:53
  • ServeTheHome also discovered this issue recently: servethehome.com/…
    – bwDraco
    Sep 24, 2016 at 15:10
  • 3
    @surfasb "Unless it is a first gen SSD, your laptop will die before the SSD does." Now it is the opposite - the new TLC based SSDs have much shorter life than old ones with MLC and especially than these with SLC NAND.
    – ggurov
    Dec 1, 2016 at 10:56

6 Answers 6

24

I did an investigation of where writes to my SSD come from. I found the same thing you did. After analyzing logs of writes as well as thinking about things I realized that it is Firefox's crash recovery. In order to be able to recover from a crash Firefox has to write the session to disk. The session information is stored in the four files you listed. Firefox updates these every ~30 seconds. With lots of tabs in a big session this adds up to a few GB per day.

But as surfasb says, it is not really anything to worry about.

6
  • 1
    Thanks! good analysis. Do you know if it's possible to change the frequency of disk writing? Every 30 seconds seems rather too often for me
    – marcin
    Mar 12, 2012 at 21:40
  • 9
    In about:config there is a setting called browser.sessionstore.interval. Interestingly according to it Firefox should store every 15 sec. This was not the interval I observed.
    – Mr Alpha
    Mar 13, 2012 at 5:59
  • Note that these excessive writes are definitely something to worry about if you've got an SSD.
    – Pointy
    Sep 23, 2016 at 17:31
  • 1
    Not really. If Firefox does 10GB of writes in a day, that still only adds up to 36TB of sequential writes in a decade. Even if its such a low end SSD that 36TG sequential writes were a problem, in a decade something else will probably have had the time to die first.
    – Mr Alpha
    Sep 24, 2016 at 13:12
  • 3
    Those 70-75 TB numbers are related to the warranty, meaning you can't replace it under warranty if you've exceeded that number of writes. It does not mean the drive will wear out and die at that point, no more then that the drive would die after 3 years just because it has a 3 year warranty. As is generally the case with warranties, they are quite conservative.
    – Mr Alpha
    Dec 2, 2016 at 15:15
33

There is a setting in Firefox that controls how often the session restore saves files. Go to about:config and change:

  • browser.sessionstore.interval to change how often the session is saved. On my system, the default was 15000 (milliseconds) so it was writing to disk every 15 seconds. If you increase this to 300000, it will only write every 5 minutes.

  • browser.sessionstore.enabled can be turned to false to disable this feature completely. This will reduce the amount of disk writes Firefox does, but this will also prevent Firefox from restoring your session when it crashes.

2
  • On my RHEL 7, firefox pushed up my load to 6, but it does not contribute much on CPU usage. So it should be the I/O that consume that. This solution actually reduce the I/O traffic thus make Firefox usable again. Mar 4, 2016 at 0:49
  • 1
    browser.sessionstore.enabled has been removed long ago. You can still do something kinda similar with resume_from_crash=false and max_tabs_undo=0
    – krubo
    Sep 19, 2021 at 21:28
3

After loading about 10 pages and some in Chrome mine looks like this:

iotop -a output

So I guess that's normal swap/page file use.

(Although one would think with me only using 31% of RAM it wouldn't swap at all.)

1
  • Thanks for testing! I doesn't look like swapping, apparently firefox if forcing writing some files to disk as often as possible rather than keeping them in memory.
    – marcin
    Mar 12, 2012 at 17:38
1

FF was writing to disk constantly at 2.5+ MB/s! I ran sudo iosnoop -p PID and found that the Evernote Web Clipper was doing all the writing. I removed it and disk writes went down to 0 to a few kb/s.

1
  • sorry for the probably silly question but, was the FF process (via the Evernote addon), or the Evernote process itself which was saturating your I/O? In the first case, how iosnoop was able to detect it? I have never used the tool but I thought it traced the I/O of processes, and could not distinguish Firefox own usage from an extension running in Firefox.
    – Antonio
    Apr 16, 2019 at 13:28
-2

It is perfectly normal for a browser to store changes to cookies and sessions to the disk. The data about which tabs you had open has to be kept somewhere. Your usr directory (I assume that is where Firefox stores those things) shouldn't be located on an SSD to begin with, move it to an HDD.

5
  • 1
    The problem is with large amount of written data, several orders of magnitude more than what is needed to store cookies or open tabs. Regarding HDD, I have only SSD.
    – marcin
    Mar 11, 2012 at 13:52
  • Is it a laptop or a similar device? Using a pure SSD setup isn't very efficient, so if you could help it I'd advise getting an HDD to store volatile files. I suppose it's possible that there's something wrong with your FF, but I doubt it would be easy to diagnose with the data we have. Have you tried backing up your FF profile and doing a clean install?
    – kotekzot
    Mar 11, 2012 at 13:59
  • 3
    I don't see how not using SSD is supposed to help. If the file is accessed frequently it's perfectly fine and even recommended to keep it on SSD. I can understand storing movies/photos on HDD since the time/speed isn't that important here but since the files are accessed frequently it should be stored where it is. If you would put this in your answer I would -1 it. The answer itself is good, just the comment not really something to relay on.
    – MadBoy
    Mar 11, 2012 at 16:51
  • @MadBoy It shouldn't matter much for overall speed if these files are located on an HDD, but it will do wonders for SSD longevity.
    – kotekzot
    Mar 11, 2012 at 16:55
  • 2
    kotekzot - "it will do wonders for SSD longevity" - any resource to support your claim? I would say that storing sessions on SSD is much better because it is fast and doesn't make neverending noise / is not annoying.
    – Tomas
    Jul 23, 2013 at 14:43
-2

Perhaps someone has a compromised the machine and is using it for anonymous P2P or F2F networking with obfuscated and encrypted filesystems? Like:

https://en.wikipedia.org/wiki/I2P

or

https://en.wikipedia.org/wiki/Darknet_(file_sharing)

https://en.wikipedia.org/wiki/Botnet

3
  • 1
    that's probably not this, but thanks for trying to help, -1 was not by me :)
    – marcin
    Mar 12, 2012 at 17:44
  • i probablyy made too many assumptions anyway, but I guess one shouldn't suggest disaster without testing first. and i forgot how big images and stuff on web pages can be. Mar 13, 2012 at 3:42
  • they may do that because they don't want to take up RAM when you decide to start up photoshop or something, and its impractical/not allowed to write rules around it, at a guess. Mar 13, 2012 at 3:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .