Live data from Hacker News

Heavy SSD Writes from Firefox

servethehome.com

141–150 of 361 posts

Re: Heavy SSD Writes from Firefox

#141
post #5

Earlier quoted context omitted.

You need to enable multiprocess in Firefox, so the thing doesn't shit the bed on you constantly. https://wiki.mozilla.org/Electrolysis

Look out for addons. Electrolysis will still not work with many of them. I force enabled it a few weeks ago, and discovered that it's disabled for good reasons.

Have about ten plugins, no issues here. It's worth actually having a browser that doesn't consume all available resource.

Re: Heavy SSD Writes from Firefox

#142
post #126

Hi, I’m one of the Firefox developers who was in charge of Session Restore, so I’m one of the culprits of this heavy SSD I/O. To make a long story short: we are aware of the problem, but fixing it for real requires completely re-architecturing Session Restore. That’s something we haven’t done yet, as Session Restore is rather safety-critical for many users, so this would need to be done very carefully, and with plent…

How about this: 29 out of 30 times, save only a diff to the previous data. 1 out of 30 times, save the complete data in compressed form. (I'm guessing there must already be functionality to diff a bunch of JSON somewhere in the millions of lines of code). Though I'm sure this doesn't make usually make a dent in a SSD's lifetime. But there are still people running Firefox on low end Android phones with meager flash, a…

> How about this: 29 out of 30 times, save only a diff to the previous data. 1 out of 30 times, save the complete data in compressed form. > > (I'm guessing there must already be functionality to diff a bunch of JSON somewhere in the millions of lines of code).

That is actually a good idea we haven't considered yet. A bit too brute force for my tastes, but relatively easy to implement. We would need to determine how much CPU is needed for a diff between two 300Mb JSON files, though (yes, some users have these).

Of course, we're back to the issue of manpower, but definitely worth trying out.

> Though I'm sure this doesn't make usually make a dent in a SSD's lifetime. But there are still people running Firefox on low end Android phones with meager flash, and Raspberry Pis with SD cards.

The implementation of Session Restore for Android is largely independent, so I'm not sure how it works these days.

Re: Heavy SSD Writes from Firefox

#143
post #137

Earlier quoted context omitted.

How about this: 29 out of 30 times, save only a diff to the previous data. 1 out of 30 times, save the complete data in compressed form. (I'm guessing there must already be functionality to diff a bunch of JSON somewhere in the millions of lines of code). Though I'm sure this doesn't make usually make a dent in a SSD's lifetime. But there are still people running Firefox on low end Android phones with meager flash, a…

You also need to handle all corner cases where one of the intermediary diffs gets corrupted (you can't generally assume in a program like Firefox that data you write out is going to be readable in the future because lol common hardware). Or where the diffs are larger than a fresh snapshot. And you absolutely can't get it wrong. It's something that sounds easy until you actually try to get it coded up and shipping. I…

Firefox does generally assume that the filesystem is reliable (as long as you use fsync properly etc). Witness eg its reliance on SQLite for data storage.

Re: Heavy SSD Writes from Firefox

#144
post #67

I have been running Firefox for a long time with an LD_PRELOAD wrapper which turns fsync() and sync() into a no-op. I feel it's little antisocial for regular desktop apps to assume it's for them to do this. Chrome is also a culprit, a similar sync'ing caused us problems at my employer's, inflated pressure on an NFS server where /home directories are network mounts. Even where we already put the cache to a local disk.…

If my memory serves correctly, Session Restore doesn't use sync()/fsync() at all.

Edit Double-checked in the code: I'm right, it doesn't.

Edit If you're interested in how Session Restore improves the safety of its writes without using sync()/fsync(), the details are on my blog: https://dutherenverseauborddelatable.wordpress.com/2014/06/2...

Re: Heavy SSD Writes from Firefox

#145
post #99

Earlier quoted context omitted.

The web browser is basically everything I do, though. My email is in it, my code review is in it, my IM is in it, on some of my machines my terminals are in it (via the Chrome mosh app).

Email/code review/IM/terminal doesn't justify 12GB of writes per day (and attendant hit to drive endurance/battery life). Those are lightweight activities. Emacs can do all those things and it doesn't write to disk unless you tell it to. Heck, even bloated beyond belief Outlook + Visual Studio + Skype + PowerShell wouldn't create anywhere near that kind of background activity.

Those applications have the benefit that they know exactly what the user data is, what their own state is, and how much of that is due to user input. The browser doesn't have that advantage. For one, state is coming off of the network all the time.

Re: Heavy SSD Writes from Firefox

#146

Earlier quoted context omitted.

I made a simple firefox/chrome extension for people like you and me that horde tabs. You might find it useful to find tabs and quickly navigate to them by clicking on the link in the list. It's free and open source. The github page has a gif showing usage. Chrome Extension: https://chrome.google.com/webstore/detail/tabist/hdjegjggiog... Firefox Extension: https://addons.mozilla.org/en-US/firefox/addon/tabist/ source…

this is brilliant. P.S. your chrome link is broken. On suggestion - please give a button to save all of this as a "session" or something. I'm a tab hoarder and sometimes I just want to dump it somewhere and start afresh. Please help me !

Thanks! the link is fixed now... I actually did just this thing the other day but didn't know if other people would want it. I will update the addon with it.

Re: Heavy SSD Writes from Firefox

#147
I have fixed this issue forever. I got a Thinkpad P50 with 64 gigs of ram. So, I just mount a tmpfs over ~/.cache.

I actually use a tmpfs for a few things:

    $ grep tmpfs /etc/fstab
    tmpfs	/tmp			tmpfs	nodev,nosuid,mode=1777,noatime	0 0
    tmpfs	/var/tmp/portage	tmpfs	noatime	0 0
    tmpfs	/home/zx2c4/.cache	tmpfs	noatime,nosuid,nodev,uid=1000,gid=1000,mode=0755	0 0

Re: Heavy SSD Writes from Firefox

#148
post #106
post #81

Earlier quoted context omitted.

And what if the server sends something different back when you visit the URL again? The internet allows it to do that.

The job of a browser is to view the internet. Not to cache it.

It needs to save enough state to give you the same view.

Re: Heavy SSD Writes from Firefox

#149
post #147

I have fixed this issue forever. I got a Thinkpad P50 with 64 gigs of ram. So, I just mount a tmpfs over ~/.cache. I actually use a tmpfs for a few things: $ grep tmpfs /etc/fstab tmpfs /tmp tmpfs nodev,nosuid,mode=1777,noatime 0 0 tmpfs /var/tmp/portage tmpfs noatime 0 0 tmpfs /home/zx2c4/.cache tmpfs noatime,nosuid,nodev,uid=1000,gid=1000,mode=0755 0 0

Fwiw, Session Restore doesn't hit ~/.cache at all. (Afaict, I'm the last person who changed how Session Restore writes its files).

Re: Heavy SSD Writes from Firefox

#150
post #84

Chrome, on my system, is even more abusive. Watch the size of the .config/google-chrome directory and you'll see that it grows to multi-GB in the profile file. There is a Linux utility that takes care of all browsers' abuse of your ssd called profile sync daemon, PSD. It's available in the debian repo or [1] for Ubuntu or [2] for source. It uses `overlay` filesystem to direct all writes to ram and only syncs back to…

Launchpad is such a shitty website, aimed at Ubuntu and only Ubuntu, links to source code or more information are nowhere to be found... Searching on Github, this seems to be it. Turns out, there's releases for Arch, Debian, etc. and it's even in the repositories. No need to add a ppa. https://github.com/graysky2/profile-sync-daemon For Debian and co: $ apt-cache show profile-sync-daemon $ sudo apt-get install profil…

The link in question was to an Ubuntu PPA on Launchpad, but Launcpad is by no means Ubuntu-only.

See eg https://launchpad.net/openstack, https://launchpad.net/inkscape, https://launchpad.net/shutter etc

Post reply on HN