This post is to help you improve mobile broadband speed on your linux system, be it a laptop, notebook, tablet or desktop. The same guide should work equally well under windows as the software used is freely available on those platforms – the configuration files should be exactly the same so feel free to give it a try!

I set out with the goal of making my browsing experience faster while being out and about with mobile broadband. As things panned out, I was able to improve my browsing speed using well known techniques in caching and acceleration, as well as cut down on data use so my bandwidth allowance/fair use policy takes longer to hit. Bonus!

Caching
Caching is the art of storing local copies of the parts that make up a web page, so next time you visit that same site, navigate to a new page on that same site or refresh that site, your browser does not need to re-download all of the components of the web site all over again. This saves you your braodband allowance (on prepay) or keeps you away from your ‘fair use policy’ limits longer (on post pay/contract). This also makes pages load quicker as your browser gets copies of what it needs without talking out to the slow internet. Its a simple concept, but one that is highly efective. One thing to note – caching will never increase the maximum throughput of your mobile broadband, what it will do is ensure that you need to use your mobile broadband throughput as little as possible – keeping your bandwdith free for other uses, keeping your data use down and making pages load quicker. Simple huh?

Acceleration
I also use a very cool piece of software called polipo to do whats known as ‘persistent connecitons,’ ‘pipelining’ and ‘poor mans multiplexing.’ Multiplexing is a technique that dates back to the good old days of accessing mainframes and allowed many slower connections to share one larger connection. Polipo implments something akin to this which can make browsing over slower (and less responsive) mobile broadband much faster.

Persistent connections
HTTP 1.1 or above allows for the transfer of multiple objects from a web server to your computer on a single TCP connection. This cuts down on the number of TCP connections that are made over your mobile broadband connection. Normally HTTP connections from your browser open, ask for one object, then close. One of the drawbacks of mobile broadband is its latency, so when using the HTTP protocol with this ‘open-request-close’ behavior, the latency can slow things down a lot. Polipo takes this ‘open-request-close’ behavior from your browser and turns it into ‘open-request-receive-request-receive-request-receive’ and so on. This means you are not opening up new TCP connections every time your browser needs to get a small part of a web page, thus making it faster.

Polipo also implements pipelining in conjunction with persistent connections.

Polipo uses pipelining to reduce this by only having to open that conneciton once (persistent connection) and also being ‘assymetric’ with its requests – asking the server for more objects while its still downloading other objects. A brief overview from the polipo site ma help, and im sure a google search can help you learn more about this technique.

Suffice to say, these techniques works very very well with mobile broadband.

sudo apt-get update
sudo apt-get install squid polipo

My polipo config file;


allowedClients = 127.0.0.1
chunkHighMark = 50331648
objectHighMark = 16384
diskCacheRoot = ""
dnsQueryIPv6 = no
pmmfirstSize = 16384
pmmSize = 8192
maxAge = 0
maxExpiresAge = 0
diskCacheRoot=""

Make sure to not specify anything for “diskCacheRoot” = just leave the queot marks with nothing in them. No point in having doulbe caching.

my squid.conf;

acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access deny all
icp_access allow localnet
icp_access deny all
http_port 192.168.3.1:3128 transparent
hierarchy_stoplist cgi-bin ?
cache_mem 32 MB
maximum_object_size_in_memory 128 KB
cache_dir ufs /var/spool/squid 100 16 256
store_dir_select_algorithm least-load
minimum_object_size 0 KB
maximum_object_size 10240 KB
update_headers on
access_log /var/log/squid/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Package(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320
acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
extension_methods REPORT MERGE MKACTIVITY CHECKOUT
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
acl lan src 192.168.3.0/24
http_access allow localhost
http_access allow lan
hosts_file /etc/hosts
coredump_dir /var/spool/squid
forwarded_for off
cache_peer localhost parent 8123 0 no-query no-digest

Share this post

Leave a Reply