14 Jun 2008 elanthis   » (Journeyer)

Fedora Firefox Fsync Fix

The sqlite/fsync behavior of Firefox that’s been so heavily publicized lately is biting me in the ass, and hard. When Firefox is open, my machine frequently starts churning the disk, and any application which needs to write to the disk grinds to a halt. The second these 15-25 second pauses are done another one usually starts. It is quite literally driving me out of my mind in frustration.

For whatever reason, Fedora does not seem interested in fixing the issue. Despite Mozilla’s recommendation to apply a patch to fix the issue, Fedora will not do so (according to the bug report). I don’t know if 3.0 RC2 fixes the bug upstream, but even if it does, there are no Firefox updates for Fedora. I’m pretty much on my own here.

I tried to use a simple fsync wrapper with LD_PRELOAD, but I could not for the life of me get it to work. I don’t know why, as logically it should work just peachy. The library gets pre-loaded, but the wrapper functions just never get called. I’ve done this sort of thing before I was fairly confident that I was doing everything right, but the fact that it didn’t work clearly indicates I overlooked something.

My current “hack” is rather extreme, but it’s doing the job wonderfully. Given that I have an excess of RAM in this machine (2GB is more than I need… and I’m adding more in a week or two), I decided to create a tmpfs filesystem with a limit of 500MB, backed up my .mozilla directory, put a copy on the tmpfs filesystem, and symlinked ~/.mozilla to that. Since fsync is now essentially a no-op, I no longer get greats amount of disk churn.

It’s worth noting that some of the other programs i use probably contributed to the excessive churn. Pidgin writes to disk way too often (there are bugs open upstream on this), and for whatever reason it fsyncs even on the unimportant ones, like buddy icon caches. Evolution caches mail on the disk. Vim is constantly writing its swap file and fsyncing left and right. It probably shouldn’t be too much of a surprise that a ton of processes are building up data to be written out, fsyncing, and while blocked more data is built up, just to be followed by another fsync.

Particularly frustrating though is that even when I’m not actively using Firefox — it’s open, but on another workspace, not being interacted with, not even with sites using JavaScript or automatic page refreshes — it still manages to make my disk churn. Likewise, Pidgin seems to be writing files out at various points in time even though nobody is IMing me, nobody’s status is changing, my preferences aren’t changing, etc.

In any event, the tmpfs thing works. I just hope I remember to copy the data back to my real ~/.mozilla before I shut down the computer, because I actually do like to keep my history. I just want it to work like Firefox 2 where keeping my history did not require sacrificing my I/O throughput and sending my disk drive to an early grave.

Fedora Firefox Fsync Fix… Four F’s? Freakin’ Fantastic!

Syndicated 2008-06-14 01:00:19 from Sean Middleditch

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!