9/03/2010

09-03-10 - Page file on Ramdrive = 3LIT3

One of the awesome new "tweaks" that computer buffoons are doing is making ramdisks and putting their windows swap file on the ram disk. Yes, brilliant, that speeds up your swap file alright. So awesome.

(BTW yes I do know that it actually makes sense in one context : some of the fancy ram drives can access > 3 GB RAM in 32 bit windows, in which case it gives you a way to effectively access your excess RAM in an easy way on the old OS; but these geniuses are on Win7-64).

(And of course the right thing to do is to disable page file completely; sadly Windows has not kept up with this modern era of large RAMs and the page file heuristics are not well suited to use as an emergency fallback).


What I have copied from the tweakers is putting my firefox shite on a ram disk :

SuperSpeed Firefox By Putting Profile and SQLite Database in RAMDisk Raymond.CC Blog
Guide Move 99% of All Firefox Writes off your SSD

I can get away with a 128M ram disk and it massive reduces the amount of writes to my SSD. Reducing writes to the SSD is nice for my paranoia (it also speeds up firefox startup and browsing), but the really strong argument for doing this is that I've caught SQLite eating its own ass a few times. I really hate it when I'm just sitting there doing nothing and all of a sudden my fan kicks in and my CPU shoots up, I'm like "WTF is going on god dammit". Well the last few times that's happened, it's been the SQL service fucking around on its files for no god damn good reason. I'm not sure if putting the firefox SQL DB files on the ramdisk actually fixes this, but it makes it cheaper when it does happen anyway.

Also, don't actually use the above linked methods. Instead do this :

Do "about:config" and add "browser.cache.disk.parent_directory" . Obviously also check browser.cache.disk.enable and browser.cache.disk.capacity ; capacity is in KB BTW.

Run "firefox -ProfileManager". Make a new profile and call it "ramprofile" or whatever. Change the dir of that profile to somewhere on the ramdisk. Look at your other profile (probably "default") and see what dir it's in. Make "ramprofile" the default startup profile.

Quit firefox and copy the files from your default profile dir to your ramprofile dir. Run firefox and you are good to go.

Do not set your ramdisk to save & restore itself (as some of fancy ramdisks can do these days). Instead put the profile dir copy operation in your machine startup bat. It's somewhat faster to zip up your default profile dir and have your machine startup bat copy the zip over to the ramdisk and unzip it there.

There's another advantage of this, which is that your whole Firefox profile is now temporary for the session, unless you explicitly copy it back to your hard disk. That's nice. If you pick up tracking cookies or whatever while browsing, or some malicious script changes your home page or whatever, they go away when you reboot.

6 comments:

Autodidactic Asphyxiation said...

Back in the DOS FAT compression days, I would make a compressed ramdisk and save the image to HD. Good times.

Yeah, moving SQLite to a ramdisk is lame-ish to me. Maybe you want to keep your state pristine, and that sounds nice, but honestly you know when you're being frisky and should just use the private browsing feature.

But most of all, it isn't slow because it is hitting disk, but because it is putting on airs, pretending to be a real database, and tries to be all transactional and sync-heavy. I don't use FF that often, but I had it configured so that fsync was ignored using libeatmydata. On Windows you could probably do something like that with Detours or equivalent RAD stuff (I vaguely remember Jeff mentioning this..?)

Oh, and not sure if you did this to your laptop, but you can enable the "advanced performance" delayed write cache. I think that was originally designed for DB-like loads, and is a nice inherited-from-server feature. Should be reasonably safe since laptops are inherently resistant to sudden power failure.

cbloom said...

"But most of all, it isn't slow because it is hitting disk, but because it is putting on airs, pretending to be a real database, and tries to be all transactional and sync-heavy."

Yeah, seriously. The main thing that FF uses SQL for is just to store key:data pairs, which you do not need a full damn database for.

Obviously it's a hack, but I prefer it to trying to dig around in how to make SQL work better.

"Oh, and not sure if you did this to your laptop, but you can enable the "advanced performance" delayed write cache"

Hmm.. I assume that just makes it flush the write cache less often? I'm actually pretty opposed to write caching in general. I've had some severe disk corruption in the past due to that.

Write caching + developers who can hard crash their machine at any moment = bad combo

Once in a while when I was being smart I would make a separate partition for development and would have my test programs write data there.

Autodidactic Asphyxiation said...

Chrome uses SQLite and doesn't have these problems for whatever reason, but the thing was built from the ground-up to have good interactive performance. I think it is possible to configure SQLite through FF. Apparently, you can do stuff like:

http://lifehacker.com/5344418/make-firefox-faster-by-vacuuming-your-database

and:

https://bugzilla.mozilla.org/show_bug.cgi?id=421482#c28

It has been quite a long time since I've hard-crashed a machine; maybe a few years ago when I was doing more stuff with virtual machines on Windows. I suppose that during your day-to-day you risk a video driver going nuts. I don't know anything about the new Vista/Windows 7 user-mode drivers. Does that make things more reliable?

cbloom said...

"It has been quite a long time since I've hard-crashed a machine; maybe a few years ago when I was doing more stuff with virtual machines on Windows. I suppose that during your day-to-day you risk a video driver going nuts. I don't know anything about the new Vista/Windows 7 user-mode drivers. Does that make things more reliable?"

Yeah, video is still the main way to hard crash. It's way way better than it used to be, Vista/Win7 is really pretty good.

Perhaps more common than real hard crashes now is that you can still get yourself into a state where your machine is not able to shut down properly and you have to hard power it. I guess in those cases I could do the manual "please flush write caches now" thingy.

Aaron said...

I think you mentioned this before but Win7 totally fucked up the ctrl-alt-delete. It used to be like super authoritative. Now if explorer has crashed or there's something really hogging CPU god help you if you can get ctrl-alt-del to work. Rrrr.

cbloom said...

In other news, do NOT start running procmon and investigating WTF your machine is doing when you think it's doing nothing at all. I need to just pretend I don't know about it or I'll get sucked into a world of painful Windows feature disablements. La la la I see nothing...

old rants