Posts Tagged firefox
Stop http Pipeline from overloading your server, using connlimit iptables
Posted by admin in Uncategorized on January 25, 2009
Have you edited or tweaked your pipeline settings in Firefox?
You can do it by typing about:config in your firefox url tab.
Most blogs and tutorial will tell you to set high values to improve the speed, such as this one: www.mydigitallife.info/2007/10/16/speed-up-your-firefox-by-adjusting-your-http-pipelining/
Many people will go crazy and make values even higher such as:
network.http.pipelining.maxrequests 32
network.http.max-persistent-connections-per-proxy 128
network.http.max-persistent-connections-per-server 128
network.http.max-connections-per-server 256
These settings are very high and will create at least 32 connections to your server.
if you have many images and SSI includes, it could overload your apache webserver.
If you use apache2.2 with worker_mpm it will create 1 thread for each connection, thus you will have 32 new threads forked within just a few seconds.
Of course if you have a quad-core server with lots of ram you should not bother to read this.
But for most cheap vps and single core servers, it can really help.
so how you do it? simple, just use iptables conn_limit module
iptables -I INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 8 -j REJECT
you may need to adjust the order or to insert or append like
# to apped to the end of the INPUT chain:
iptables -A input …
or
# to insert at position 10 of the input chain:
iptables -I input 10 …
I have tested this schema and work very well with firefox pipeline freaks.
the server will only then take up to 8 simultaneously connections per IP
to test the established connections you can try with netstat from the server:
netstat -na | grep -i esta | grep -v 127.0.0.1 | sort -n -t. -k2
Any comments, suggestions are welcome …
Update:
This can be not so good to legit users behind a proxy or firewall, because the the IP will be unique to all users behind the proxy/firewall.
in this case, you would increase the limit value.
Blazing Fast Firefox using OSX RamDisk
Firefox does a lot of IO to the disk even thou you have lots of spare Ram, due to Sqlite, Bookmarks, History and Cache.
To make Firefox faster is to store the whole profile folder into a Ram Disk.
RamDisk in Linux are called TmpFS. You can also use shared memory folder /dev/shm if you have it in your fstab.
This post in the gentoo forums explains how to do it in Gentoo linux.
I made a similar script to make it work in OSX Leopard.
The Script have 2 parts, Start.sh and Stop.sh
Here are the Scripts:
Start.sh
#!/bin/bash # Run this script to enable the Ramdisk for Firefox profiles VolumeName="Mozilla" # Size in MB, make sure is not too low or not too high SizeInMB=220 NumSectors=$((2*1024*SizeInMB)) DeviceName=`hdid -nomount ram://$NumSectors` echo $DeviceName diskutil eraseVolume HFS+ RAMDisk $DeviceName # move the current profiles folder mv Profiles Profiles_ && # make a symlink to the ramdisk ln -s /Volumes/RAMDisk ./Profiles && # then copy it to the ramdisk /bin/cp -r Profiles_/* Profiles
Stop.sh
#!/bin/bash cd ~/Library/Cache/Firefox/ # clean the cache rm -rf Profiles/*/Cache/* && # will save your modifications back to the DISK /usr/bin/rsync -av --delete ./Profiles/ ./Profiles_/ && # sometimes during unmount it will say disk is in use. # make sure you close firefox before. umount /Volumes/RAMDisk && rm -rf Profiles && mv Profiles_ Profiles
You can also use ‘tar’ instead of ‘rsync’. I just love rsync more.
* Warning: The ramdisk contents will be erased after you umount the ramdisk.
Have fun.
Update:
To speed up firefox even moreĀ run these commands:
cd ~/Library/Caches/Firefox/Profiles for i in */*.sqlite; do sqlite3 $i VACUUM;done; cd ~/Library/Application\ Support/Firefox/Profiles for i in */*.sqlite; do sqlite3 $i VACUUM;done;

