Search

Ubuntu - Tweak Firefox for speed and SSD disk

Contents[Hide]

Ubuntu

Firefox is a very powerfull and versatile browser, but it has the tendancy of doing a huge amount of disk write accesses.

If you hold a modern computer with very fast hard disk, it's no problem.

But if your hard disk is slow or if it is a SSD drive, you then need to minimize to a maximum all the disk write access, in term of responsivness and durability.

This article will explain how to optimize firefox following two main directions :

  • minimize the write accesses (very interesting for SSD drives)
  • tweak generic parameters for performance boost

Its first effect will be a huge disk write access reduction and ... a real boost in terms of performance !

So lets start to tweak your firefox parameters to rediscover your surf experience.

If you need any detailed information about the parameters described below, just check at the source on http://kb.mozillazine.org/

Most of following options are done thru the about:config page. If some parameters do not exist, just create them (right click in the page).

This article has been done with Firefox 10 on a Ubuntu Oneiric 11.10.
It should work with any Firefox Version 3+ running on any linux distribution.
If your computer hold enough RAM, another easy and efficient tweak is also possible

1. Stop background loading

Firefox downloads webpages from links it thinks you may click. This may make the experience seem faster but really it just bogs down Firefox and your netbook.

In the about:config page, set

key value
network.prefetch-next false

2. Optimize Firefox Cache

To speed up the browsing experience and to limit the SSD write cycles, we will place firefox cache on a RAM disk. A very simple way of doing it is to place the cache directory under /dev/shm, which is a tmpfs filesystem.

The main drawback of the setup is that you will loose you browser cache after every shutdown or reboot. But on the other end, it will speed up drastically the browsing speed.

The disk.cache.memory.capacity is the amount of RAM in Kb you want to dedicate to the memory cache (131072 for 128Mb, 262144 for 256Mb, 524280 for 512Mb, ...).

In the about:config windows, set the following keys :

key value
browser.cache.memory.enable false
browser.cache.offline.enable false
browser.cache.disk.enable true
browser.cache.disk.capacity 262144
browser.cache.disk.parent_directory /dev/shm/firefox

3. Network parameters tweaks

Following parameters in the about:config page will improve your network speed in most cases.

key value description
network.dns.disableIPv6 true  
network.http.pipelining true enable pipelining for normal connections
network.http.proxy.pipelining true enable pipelining for proxy connections
network.http.pipelining.firstrequests true enable pipelining of first requests
network.http.pipelining.maxrequests 8 maximum HTTP requests per pipeline
network.http.keep-alive true  
network.http.proxy.keep-alive true  
network.http.version 1.1  
network.http.proxy.version 1.1  
network.http.max-connections 96 number of total HTTP connections
network.http.max-connections-per-server 32 maximum number of any type of connections per server
network.http.max-persistent-connections-per-server 24 maximum number of keep-alive type connections per server
network.http.max-persistent-connections-per-proxy 24 maximum number of keep-alive type connections per proxy

4. SQLite tweaks

Firefox uses sqlite for storage of information like history, bookmarks, etc.

It used to use async i/o, but ran into corruption issues. So it is now using sync i/o which blocks very easily. Sqlite runs six fsyncs per transaction for history changes. History changes happen ever time you go to a new page. If you are doing something else on the system like say a kernel compile, virtual machine image creation, or anything i/o intensive then the Firefox gui freezes, because it is waiting on the fsync to finish. This can take literally a minute to unlock.

You can go back to async i/o thru this parameter in about:config. After making changes and a restart, you will then be running Firefox without fsync.

key value
toolkit.storage.synchronous 0

5. Disable session save

Firefox automatically saves your session every 10 secs so that whenever it crashes, it can restore all your tabs. While this is a useful feature, some of you might find it irritating.

To disable this function, toggle the value of browser.sessionstore.enabled to False

key value
browser.sessionstore.enabled false

6. Anti-phishing security settings

The anti-phishing features of Firefox may cause it to become slow to start or exit, and might also affect the browsing speed since Firefox apparently contacts google for every http request. The problem is that Firefox maintains a sqlite database that might grow quite big, and reading and writing to this database begins to take some time when it grows bigger.

If you feel that you do not need Firefox to tell you which sites may be suspect you can disable this feature by turning off the following options under the security tab in preferences : "Block reported attack sites" and "Block reported web forgeries"

It can also be done under about:config keys.

key value
browser.safebrowsing.enabled false
browser.safebrowsing.malware.enabled false

After closing Firefox, you need to delete all files beginning with urlclassifier in your profile folder ~/.mozilla/firefox/xxxxxxxx.default where xxxxxxxx is some combination of letters and numbers. Some of these files might be recreated by Firefox, but they won't grow any larger than their initial size.

Here is the command line to delete these files :

# rm -i ~/.mozilla/firefox/*.default/urlclassifier*

7. Content display parameters

These parameters will change the way Firefox is displaying the pages.
It will add some inreractivity during the page display process.

key value
content.interrupt.parsing true

Once you have applied all these modification, you need to restart Firefox for them to become operational.

Your firefox should now become blazing fast ... and it won't tear your SSD drive with its permanent disk accesses.

Hope it helps.

Signature Technoblog

This article is published "as is", without any warranty that it will work for your specific need.
If you think this article needs some complement, or simply if you think it saved you lots of time & trouble,
just let me know at This email address is being protected from spambots. You need JavaScript enabled to view it.. Cheers !

icon linux icon debian icon apache icon mysql icon php icon piwik icon googleplus