Speed up Firefox by moving cache into RAM in Ubuntu
Posted Under: Mozilla Firefox
By default Firefox puts its cache in your home partition.You can speed up Firefox and reduce disk writes by moving this cache into RAM if you have 1GB RAM or more.
1.Edit /etc/fstab,open terminal from Applications->Accessories menu and type:
sudo gedit /etc/fstab
Add following into this file and close it.
tmpfs /tmp tmpfs noexec,defaults,noatime 0 0
tmpfs /var/tmp tmpfs noexec,defaults,noatime 0 0
2.Edit /etc/sysctl.conf:
sudo gedit /etc/sysctl.conf
add this line and save it:
vm.swappiness=1
3.
Type about:config in firefox address bar and click I'll be careful,I promise!.Right click on blank area and create a new string value called browser.cache.disk.parent_directory,set its value to /tmp
Now,reboot your system and experience the performance.
Original text:HOWTO : Ubuntu 9.04 Desktop on Solid State Disk (SSD)
Related posts:
- Optimize the Usage of Swap to Speed up Response for Ubuntu
- Speed up web browsing in Firefox/Opera using Local DNS
- Ubuntu using Ramdisk for better performance and fast response
- Ubuntu Tip:Speed up Firefox by compacting SQLite databases
- Virtualbox 4 on Ext4 error – host I/O cache will now be enabled

Reader Comments
Hi
I’ve implemented this with Ubuntu 9.10.
I can see that there’s now a Firefox cache in the tmp folder.
And I can see how the tmp file is mounted as tmpfs during bootup.
I wonder why more people aren’t using this method?
Maybe in future one of the options in Firefox’s preferences might offer a RAM cache option.
It’s possible to use this method with a RAM-disk in Windows. There’s a youtube video here explaining it.
Here:-
http://www.youtube.com/watch?v=6W1cHoU4R-E&feature=PlayList&p=FC21F7E2707A0845&index=0&playnext=1
[Reply]
Do your session restores still work after implementing this?
[Reply]
this one is really cool,
amazing how fast it is
[Reply]
Excellent post! Two questions:
1) Why do you use vm.swappiness=1 ?
My Kubuntu default is 60 (execute ‘sysctl vm.swappiness’ to find out). Lower swappiness seems to favour using RAM in stead of swap so it does make sense there, but this setting of course also influences other programs…
I guess if you have plenty of RAM it’s ok.
2) If tmpfs is 2GiB and not used completely (my ff cache is 14MiB now!), and other applications start to claim memory, can they get into the memory of tmpfs, or do they have to be swapped because I claimed 2GiBs for my tmpfs? (this would suggest performance degradation).
[Reply]
I know this post is old but I tried this on Ubuntu 10.04. It works, but since RAM loses all info on shutdown, it’s the same as setting Firefox to clear the caches on each shutdown. For many of us who re-visit the same websites over and over for news etc, the overall effect is to significantly slow things down.
[Reply]
Thank you much for your 3 Lines…
Before (ubuntu 11.04, ff 4.0)
1 site – after 10 minutes 200 MB for nothing – hardisk is heavy working for nothing and the heads are very noisy
(today hd dont crash because old, but because useless datatransfer by browsers!!!)
After 3-4 tabs – after 10 minutes less than 100 MB – and the harddisk is silent, after loading ff
[Reply]