Placing Firefox cache in RAM on Ubuntu

firefoxTo enhance Firefox performance on Ubuntu (or Linux), we can place the cache in RAM. This is especially helpful if you are used to hours of continuous browsing sessions.

I have mounted some directories with temporary files using the tmpfs, which is RAM based filesystem. These files will be discarded at reboot, which also helps to keep my system clean.

The entries in /etc/fstab are like:

tmpfs /tmp tmpfs noexec,defaults,noatime,nodiratime 0 0
tmpfs /var/log tmpfs noexec,defaults,noatime,nodiratime 0 0

Add the following line at the end of /etc/sysctl.conf file:

vm.swappiness = 0

Run:

# sudo sysctl -p

In Firefox, go to about:config page and search for the following entry:

browser.cache.disk.parent_directory

If it is not there, right click and create a new String value and name it as

browser.cache.disk.parent_directory

Set the value to /tmp (or tmpfs directory of your choice). Restart Firefox.

2 thoughts on “Placing Firefox cache in RAM on Ubuntu”

Leave a Reply

Your email address will not be published. Required fields are marked *