Page 1 of 9 123 ... LastLast
Results 1 to 10 of 83

Thread: Howto; Firefox profile in RAM for increased speed and stability

  1. #1
    Join Date
    Jun 2006
    Location
    Gothenburg
    Beans
    142
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Talking Howto; Firefox profile in RAM for increased speed and stability

    NOTE: This howto has been tested in Ubuntu 9.04 Jaunty Jackalope and Firefox version 3.0.8.

    This howto is based on the discussion from a forumthread over at the Gentoo Forums and this guide from verot.net
    Credits goes to stevenrobertson at the Gentoo Forums for the original post

    One of the problems that will disappear after completing this guide is based on the following

    Firefox uses SQLlite to store most of its information, which makes it quite slow. As SQLite accesses are IO-bound, Firefox suffers when the disk is heavily used by other processes.
    Source

    The result of this guide will give you

    * Much less disk activity
    * Immediate search results when you search in about:config and the AwsomeBar.
    * None/Very few Firefox hangups/freezes.
    * Faster rendering of webpages.
    * Less power-consumption

    For those of you who have slow SSD-harddrives and laptops with 5400 rpm harddrives will most likely benefit the most from this guide, the difference before and after will be huge.

    You don't need a lot of RAM to benefit from this guide. Your Firefox profile don't need to be especially large if you reduce the amount of cache in your Firefoxprofile, I guess approximately 64 MB additional RAM is atleast required to benefit from this guide.

    To see how much difference this guide really do, I recommend that you start by doing the following easy tests.
    Open up a new tab and see how fast the new tab appears. Start typing some webpage you visit frequently into the address bar (AwsomeBar). Try to get an idea of how quickly the AwsomeBar works. Try also to enter about:config and get an idea of how quickly the results come up in your searches. After you completed this guide, do the same tests to see some of the differences in speed you will get from this howto.

    So lets start this guide;

    Type about:config into Firefox AwsomeBar and press Enter. Read the message that comes up and then click it to enter about:config

    Type browser.cache.disk.enable into the filter field and verify that the value is True. If set to False doubleclick the result to change to True.
    Type browser.cache.disk.capacity into the filter field and doubleclick the result to change the value. If you want your Firefoxprofile to use only a small amount of RAM change the value to 20000 or below. If you have plenty of free RAM enter a big value, like 128000 or more. I have 4 GB of RAM so I use the value 131072 [128 Mb]
    This value is just one part of your Firefoxprofile so the total amount of RAM the Firefoxprofile will use will be about 50 Mb more. Remember the value you enter, we need it later on.

    The original author suggested to change the values for

    browser.safebrowsing.enabled to False

    browser.safebrowsing.malware.enabled to False

    I recommend you also to follow some guide on the internet that suggests good modifications for about:config for great improvement in speed.

    After this is done, go to your .mozilla/firefox folder and create a folder there and name it profile. The folder .mozilla is hidden so you have to press Ctrl + h in your homedirectory to see hidden files and folders.
    Copy all of the content from the folder xxxxxx.default(xxxxxxx represents random letters and numbers) into the folder profile. If you are going to use a small amount of RAM for your Firefoxprofile then empty the folder Cache inside your xxxxxx.default folder before copying the content.
    I recommend you to make another copy of xxxxx.default and place it somewhere safe just in case something happens.
    The folder profile will be used for saving the changes to your Firefoxprofile from RAM so the changes wont get lost after computer shut downs or a after a reboot. More on that later.

    Create now in a place you remember an empty file (Right-click on eg the desktop and select Create Document -> Empty file). Give the file the name tmpfs_firefox.sh
    Doubleclick the file and paste the following text to it.

    Code:
    #!/bin/bash
    
    # Change this to match your correct profile
    PROFILE="xxxxxxxx.default"
    
    cd "${HOME}/.mozilla/firefox"
    
    if test -z "$(mount | grep -F "${HOME}/.mozilla/firefox/${PROFILE}" )"
    then
        mount "${HOME}/.mozilla/firefox/${PROFILE}"
    fi
    
    if test -f "${PROFILE}/.unpacked"
    then
        rsync -av --delete --exclude .unpacked ./"$PROFILE"/ ./profile/
    else
        rsync -av ./profile/ ./"$PROFILE"/
        touch "${PROFILE}/.unpacked"
    fi
    
    exit
    Important: Modify the line PROFILE="xxxxxxxx.default" so it represent the exact name of your xxxxxxxx.default directory.
    My folder is named rcw72e7n.default so my line will look like this

    PROFILE="rcw72e7n.default"

    When your are absolutely sure your file is correct save the file and exit your editor,
    Rightclick the file tmpfs_firefox.sh and select Properties. Go to the tab Permissions and change the permissions so Run is marked to the right of owner. Close the window when you are finished.

    Now press Alt + F2 and enter

    gksudo gedit /etc/fstab

    and hit Run.

    I the textdocument that appears put this line to the end of the file

    Code:
    firefox /home/USERNAME/.mozilla/firefox/xxxxxxx.default tmpfs size=AMOUNT_OF_RAM_TO_USE,noauto,user,exec,uid=1000,gid=1000 0 0
    Important: Change USERNAME to your own name. Change xxxxxxx.default so it represents the name of your xxxxxxx.default folder. Change AMOUNT_OF_RAM_TO_USE to a value about 70Mb larger than your browser.cache.disk.enable value. In other guides, where people have made similar modifications, it has been recommended 128M if browser.cache.disk.capacity is set to 20000.
    I used the value 131072 [128 Mb] for my browser.cache.disk.capacity so the line for me to put into /etc/fstab would look something similar like this

    Code:
    firefox /home/leif/.mozilla/firefox/rcw72e7n.default tmpfs size=200M,noauto,user,exec,uid=1000,gid=1000 0 0
    When you are absolutely sure your line is correct save the file and exit the editor.

    We must now empty the content of your .mozilla/firefox/xxxxxx.default directory. To do this we have to shut down Firefox completely to avoid Firefox from re-create the profile. You can copy the relevant part of the guide to a text file or use another browser for the next part, but you have to exit Firefox before erasing the content. Before you empty the folder, doublecheck that you have a copy of the content of .mozilla/firefox/xxxxxx.default in the directory .mozilla/firefox/profile and I recommend an extra copy somewhere safe.

    When Firefox is closed erase the content of .mozilla/firefox/xxxxxx.default. Look down to the left corner in the Nautilus window and remember the amount of free space you have in your .mozilla/firefox/xxxxxx.default directory.

    When this is done locate the file tmpfs_firefox.sh we created earlier and doubleclick it. A window will appear. Chose Run in terminal.
    You will now see a terminal window open and close very quickly. This is normal and due to the fact that the whole process went very quickly. The script mounted your Firefox profile into your computer's RAM. Double-click again on the file tmpfs_firefox.sh and select once more Run in terminal. The same thing happens as before but with the difference that the script synchronized the contents of the folder with your profile folder xxxxxx.default.

    Now enter the folder xxxxxx.default. You should now see that the erased files are back.
    Look down to the left corner in the Nautilus window when you are in the folder xxxxxx.default and you should see that the value of free discspace now have changed and now shows the amount of free space in your computers RAM for the xxxxxx.default folder. If you see no difference try hitting refresh in nautilus.

    If the content of xxxxxx.default is back and the amount of free discspace inside the xxxxxx.default directory have changed to a size around the same size you entered into your /etc/fstab file you can safetely start up Firefox.
    After Firefox have started, repeat the same tests as we did at the beginning of the guide to confirm the difference in speed. Open up a new tab, this will be noticeably faster than before. Enter about:config into the awsomebar and press enter. Now the box to be careful should appear immediately. Press, I promise, I will be careful[ and you'll immediately arrive to about:config
    Perform a search in the filter box and you will see that the results will appear with no delays at all. Test also in the awsomebar to start typing a webpage you usually visit and note that the results from the search appears immediately. Another thing you will notice is that the your computer harddrive is working much less now than before. When Firefox have build up some cache, you'll also notice a difference in renderingspeed of the pages you visit.

    Now we have to make sure your computer synchronize the RAM to the hard disk so the changes in your Firefoxprofile is saved after you restart or shut down the the computer. To do this we need to install gnome-schedule. Click here to install it. When the installation is complete, start the application, Applications -> System Tools -> Scheduled tasks. If you cant find the program enter gnome-schedule into the box that appears after you press Alt + F2 and then hit Run.

    When the program have started, click New, which is at the top left of the program. A window appears. Select the top option, a task that is running recurring. A new box appears. Enter the following

    Description: Whatever you want

    Command: $HOME/.tmpfs_firefox.sh

    Mark the box that says Advanced and enter the following

    Minute: */5

    Enter a * into the four remaining fields, Hour, Day, Month and Weekday

    You can change the number 5 to another value if that suits your better. The number represents the amount of time in minutes between each backupsynchronization from RAM to the folder profile.
    After you are finished click Apply followed by Ok. Finally close Scheduled tasks.

    Now locate once again the file tmpfs_firefox.sh and move it to your home directory. After this is done rightclick on the file and choose Rename. Put an . infront of the name so the name of the file becomes .tmpfs_firefox.sh. This will make the file hidden in your homedirectory. Press refresh in Nautilus and the renamed filed should vanish. Press Ctrl + h to show hidden files and directories and you can easily locate the file if you want to.

    Now go to System --> Settings --> Startup programs

    Press add in the window that comes up.
    Enter the following:

    Name: Firefox RAM
    Command: /home/USERNAME/.tmpfs_firefox.sh
    Important: Change USERNAME to your own username

    Click Save and then Close to complete the guide.
    Now we just need to reboot the computer to make sure that everything works.
    After reboot open up a terminal and enter the command mount. If you see a line that is similar to mine it works.

    Code:
    firefox on /home/leif/.mozilla/firefox/rcw72e7n.default type tmpfs (rw,nosuid,nodev,size=200M,uid=1000,gid=1000,user=leif)
    Last edited by Bossieman; April 30th, 2009 at 03:44 AM.
    Ubuntu 7.10

  2. #2
    Join Date
    Nov 2005
    Beans
    24

    Re: Howto; Firefox profile in RAM for increased speed and stability

    I've followed this guide and it works fine, except!
    When I try to upload something (via a HTML-form) or try to download something (Right-click > Save as...) everything with FF dies completely and I have to kill it.
    Any ideas ?
    Is there some way I can check any errors? A debug-mode or whatever.

  3. #3
    Join Date
    Jun 2006
    Location
    Gothenburg
    Beans
    142
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Re: Howto; Firefox profile in RAM for increased speed and stability

    Can0n, I can do both uploads and download with no problems. I have done a lot of configs in about:config that is not mentioned in the guide.
    try setting

    browser.cache.memory.enable --> True

    and then

    browser.cache.memory.capacity --> 65536

    Just ad new Integer if browser.cache.memory.capacity doesn't exist.

    Try also to ad (if you don't have it already) the string

    browser.cache.disk.parent_directory

    and put in the path to the directory

    /home/USERNAME/.mozilla/firefox/xxxxxxx.default

    Hopes this solves it for you. What numbers did you use in the guide?
    Ubuntu 7.10

  4. #4
    Join Date
    May 2007
    Beans
    13

    Re: Howto; Firefox profile in RAM for increased speed and stability

    thats an excellent guide which is perfect for my eeepc s101. one problem i came across was that the profile wasnt being loaded up after reboot. to get around this i had to add
    Code:
    /home/anthony/.tmpfs_firefox.sh
    into gnome-session-properties. now it works fine for me but i wondered what part of the guide i did wrong??? i checked through it 3 times but everything seemed covered.

    any thoughts?

  5. #5
    Join Date
    Jun 2006
    Location
    Gothenburg
    Beans
    142
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Re: Howto; Firefox profile in RAM for increased speed and stability

    Quote Originally Posted by anthortic View Post
    thats an excellent guide which is perfect for my eeepc s101. one problem i came across was that the profile wasnt being loaded up after reboot. to get around this i had to add
    Code:
    /home/anthony/.tmpfs_firefox.sh
    into gnome-session-properties. now it works fine for me but i wondered what part of the guide i did wrong??? i checked through it 3 times but everything seemed covered.

    any thoughts?

    There is an error in the guide (fixed now).
    Instead of

    Code:
    firefox /home/USERNAME/.mozilla/firefox/xxxxxxx.default tmpfs size=AMOUNT_OF_RAM_TO_USE,noauto,user,exec,uid=1000,gid=1000 0 0
    in fstab, it should be
    Code:
    firefox ~/.mozilla/firefox/xxxxxx.default tmpfs size=AMOUNT_OF_RAM_TO_USE,noauto,user,exec,uid=1000,gid=1000 0 0
    This solves it.

    EDIT: Actually it doesnt solve it for me but I have modified the guide so it works now.
    Last edited by Bossieman; April 30th, 2009 at 03:45 AM.
    Ubuntu 7.10

  6. #6
    Join Date
    May 2007
    Beans
    13

    Re: Howto; Firefox profile in RAM for increased speed and stability

    thanks i made the changes and removed the .sh from the startup programs list

  7. #7
    Join Date
    Jul 2007
    Beans
    220
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Howto; Firefox profile in RAM for increased speed and stability

    Thanks much! The speed is incredible... Ubuntu is great since it doesn't eat up memory like windows does so I can do this and still have tons of RAM.
    Pentium 4 HT @ 2.79 Ghz | 2 GB RAM | 256 MB Nvidia Geforce 6200 | Ubuntu 8.04 Hardy Heron | Compiz Fusion 0.7.6 | Rhythmbox | Wine 1.0 | Mozilla Firefox 3 | Eclipse SDK

  8. #8
    Join Date
    Jun 2006
    Location
    Gothenburg
    Beans
    142
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Re: Howto; Firefox profile in RAM for increased speed and stability

    Quote Originally Posted by Onay View Post
    Thanks much! The speed is incredible... Ubuntu is great since it doesn't eat up memory like windows does so I can do this and still have tons of RAM.
    I noticed that using

    Code:
    firefox ~/.mozilla/firefox/xxxxxx.default tmpfs size=AMOUNT_OF_RAM_TO_USE,noauto,user,exec,uid=1000,gid=1000 0 0
    Doest work for me. I have changed the guide ones more. Now it should work.
    Ubuntu 7.10

  9. #9
    Join Date
    Apr 2009
    Beans
    4

    Re: Howto; Firefox profile in RAM for increased speed and stability

    thanx pro good jop

  10. #10
    Join Date
    Jul 2007
    Beans
    220
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Howto; Firefox profile in RAM for increased speed and stability

    Quote Originally Posted by Bossieman View Post
    I noticed that using

    Code:
    firefox ~/.mozilla/firefox/xxxxxx.default tmpfs size=AMOUNT_OF_RAM_TO_USE,noauto,user,exec,uid=1000,gid=1000 0 0
    Doest work for me. I have changed the guide ones more. Now it should work.
    Yep I did that too since it wouldn't mount for some reason. Simple fix though. Thanks again.

    Another tip that some people might find excessive but I find useful is adding a custom launcher to the panel that executes the tempfs_firefox script. I click it before I exit out of firefox in case I did something between the 5 minute sync times that I wanted to keep. Totally worth having to click on that icon before I exit firefox to have such a snappier browser... One of my biggest complaints was having a slow firefox. Not anymore
    Pentium 4 HT @ 2.79 Ghz | 2 GB RAM | 256 MB Nvidia Geforce 6200 | Ubuntu 8.04 Hardy Heron | Compiz Fusion 0.7.6 | Rhythmbox | Wine 1.0 | Mozilla Firefox 3 | Eclipse SDK

Page 1 of 9 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •