Live data from Hacker News

Heavy SSD Writes from Firefox

servethehome.com

331–340 of 361 posts

Re: Heavy SSD Writes from Firefox

#331
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…

I think you are safe to rewrite it. It is not very reliable anyway as I have lost my tabs after crashes more than once. It might have been possible to save them but after a crash first thing I would do is restart Firefox and it would sometimes just completely overwrite the recovery.js.

To mitigate this I have created a daemon to copy the file to a separate directory every few hours. I then delete those old versions manually every year or so.

Re: Heavy SSD Writes from Firefox

#332
post #84

Earlier quoted context omitted.

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

Launchpad is absolutely horrific to navigate and contribute to.

Re: Heavy SSD Writes from Firefox

#333
post #263

Earlier quoted context omitted.

this is the first I heard of this - why is this not a config flag ?

because not losing data is infinitely better than saving your ssd life a couple years. we've had ssds for a long time now. still waiting for one to die on me. meanwhile I'm on my 27th dead spinning disk.

This is my experience too.

Re: Heavy SSD Writes from Firefox

#334

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…

How do we switch it off on Chrome (Windows)?

Re: Heavy SSD Writes from Firefox

#335
post #137

Earlier quoted context omitted.

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…

In the general case that's a huge pain. In this case, where you're writing a single blob to disk, you can stick a checksum at the end and you're good to go.

If you read the bug discussion, you'll see this is one of the most problematic parts.

Re: Heavy SSD Writes from Firefox

#336
post #294

Earlier quoted context omitted.

Some people are unjustifiably worried about SSD endurance. The reality is that even with fairly heavy use, most of them will far outlive the computers they're in. And their owners for that matter! I purchased my current SSD in March 2015 - it's a Samsung 850 EVO 512GB. It's done 7332 Power_On_Hours, and 36486573259 Total_LBAs_Written, which works out as just under 17 TB written, or about 31.6 GB/day. That kind of sou…

>The reality is that even with fairly heavy use, most of them will far outlive the computers they're in. I'm not sure what the lifetime of a computer is. In my family, we are still occasionally running machines from circa 1995. They work fine. When should I stop using my MacBook? The only reason I'd stop is if it died in a way that can't be cheaply fixed.

I'm curious what useful work such a computer can perform, given that a typical 1995 computer had a 33 MHz processor, 8 megs of RAM and 1 gigabyte of hard disk space.

Re: Heavy SSD Writes from Firefox

#337
post #335

Earlier quoted context omitted.

In the general case that's a huge pain. In this case, where you're writing a single blob to disk, you can stick a checksum at the end and you're good to go.

If you read the bug discussion, you'll see this is one of the most problematic parts.

This bug? https://bugzilla.mozilla.org/show_bug.cgi?id=1304389

It doesn't talk about the difficulties in getting data safely to disk. There's just a worry that taking a hash of the entire session state is expensive. I'm skeptical that a fast hash would take long compared to the time spent serializing to JSON in the first place, let alone time spent diffing.

Re: Heavy SSD Writes from Firefox

#338
post #198
post #157

Earlier quoted context omitted.

SQLite is used exactly because it is so robust even on bad hardware. And you still need to check the data that SQLite is giving you.

Until you have a NFS homedir...

Does the lack of proper locking on NFS matter when you're only running a single instance of firefox?

Re: Heavy SSD Writes from Firefox

#339
post #144

Earlier quoted context omitted.

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...

So you're relying on the implicit write barrier many filesystems supply that ensures that the contents of a file hit the disk before a renaming of that file does. That's adequate, but I'd personally checksum the file instead of relying on corruption causing JSON to become structurally invalid.

Well, it's better when this write barrier happens (which is not true on ext4, iirc), but we rely mostly on the the fact that operating systems flush automatically within 20 seconds (I don't remember the actual numbers, but I'm almost sure it's actually within at most 5 second in practice).

Checksums/signatures would be more precise, indeed.

Re: Heavy SSD Writes from Firefox

#340
post #336
post #294

Earlier quoted context omitted.

>The reality is that even with fairly heavy use, most of them will far outlive the computers they're in. I'm not sure what the lifetime of a computer is. In my family, we are still occasionally running machines from circa 1995. They work fine. When should I stop using my MacBook? The only reason I'd stop is if it died in a way that can't be cheaply fixed.

I'm curious what useful work such a computer can perform, given that a typical 1995 computer had a 33 MHz processor, 8 megs of RAM and 1 gigabyte of hard disk space.

The same work they did in 1995. Word processing, games, internet. Computers weren't useless back then.
Post reply on HN