Faster Web-Browsing With Cache in RAM
1 Create a “tmpfs” mountpoint to store Firefox cache in memory (rather than on the hard drive)
“A temp filesystem (“tmpfs” or RAM disk, if you like) is created at the moment you mount it and destroyed when you umount it. It lives in the physical RAM, but is swapped out to your swap partition if it fills up. The default size is half your total system memory
There's a tmpfs mounted at /dev/shm, but don't use that! That's for POSIX shared memory support (which hardly any programs use, yet, so you can seriously reduce the size of that in your /etc/fstab).[1]
tmpfs is also used to support "shmfs". shmfs is a filesystem used to support POSIX shared memory. glibc 2.2 and later expect tmpfs to be mounted at /dev/shm for POSIX shared memory open and unlink.[2]
- Create a new directory: mkdir /var/FirefoxCache (do not use /tmp/FirefoxCache since the /tmp file is often wiped during system boot and if there is a mounted subdirectory (FirefoxCache) in it then it won't be wiped properly)
- Add this line to /etc/fstab
- tmpfs /var/FirefoxCache tmpfs size=100M,mode=0777 0 0
- (the "100M" part can be changed to a different maximum amount, based on Step #3, below)
- Mount the new filesystem using the new info in /etc/fstab: mount -a
2 Set Firefox to use this new location for its cache
- Enter this in the address bar: about:config
- Filter for this: browser.cache.disk.parent_directory
- If it exists, change it to /var/FirefoxCache
- If it doesn’t exist, right-click go to “New -> String”
- Name it browser.cache.disk.parent_directory with a value of value /var/FirefoxCache
3 Set Max Firefox Cache
- This number should be anything close to amount of free RAM I normally have when running Firefox. If Firefox caches more than this number, then it will swap it out to hard drive, and then the speed advantage is lost.
- Set the cache maximum this way:
- Enter this in the address bar: about:config
- Filter for this: browser.cache.disk.capacity
- Enter a value in kilobytes
- Or, in Firefox 3, go to Tools -> Advanced -> Network -> Offline Storage. Enter a value in MB's.
4 Tell FF to Clear Cache on Exit
Make sure Firefox clears its cache when it exists, so that it isn’t taking up RAM after Firefox is closed.
Method #1:
- Enter this in the address bar: about:config
- Enter this in the filer: privacy.clearOnShutdown.cache
- Set to TRUE (may double-click it, or right-click and click “Toggle”
Method #2: (for Firefox 3.1)
- In Firefox Preferences, click Privacy
- In the History section, change the drop-down menu to “Use custom settings for history”
- Check “Clear history when Firefox closes”
- Check “Cache”
5 Restart Firefox for all this to take effect
6 Verify that Firefox is using it by going to /var/FirefoxCache and seeing if Firefox has setup folders and files for use as cache, and that it disappears when Firefox closes.
Similar use of tmpfs for improving
http://apcmag.com/gentoo_tip_for_the_love_of_tmpfs.htm
There are options for doing this using a Windows program that creates a RAMDISK. Here is one (thanks John M).