From a self-confessed bandwidth-o-holic…
This is my first blog, and coincidentally my first blog post, so please forgive me if I am completely irrelevant, make horrendous errors in nature of fact, grammar or spelling or even abuse commas by creating very long winded introductions.
Anyways, just about a week ago I noticed my server had slowed to a crawl. Not just any crawl mind you, but like that slow-as-molasses kind of crawl which makes you want to scream. I quickly opened my trusty copy of PuTTY and ssh’d into the server. PuTTY was configured to automatically send my username to the server and wait for “keyboard-interactive authentication” to enter my password. I waited for about five seconds before the password prompt appeared, I dutifully entered my password and hit the enter key. Nothing… Waiting… still nothing and then finally
Last login: Mon Aug 21 13:43:39 2006 from 68.68.*.*
www ~ $
Curious as to the cause of such slowness in my precious 3GHz P4 Gentoo -O3 -funroll-loops -fomit-frame-pointer -fgo-uber-fast server, I prodded around a little bit. After checking top, CPU usage wasn’t the culprit, memory was fine, EUREKA the apachetop was showing that the connection was bottlenecking at only 6 KB/s. Had someone switched the colo’s OC-3 for a Dialup connection? The next day I took a visit to the colo and visited my cute-little-rack-mounted-box did a diagnostic from there, only to find the same results: 6KB/s. This was driving me crazy, I couldn’t even transfer a day’s log file, let alone serve more than 2 clients with my bandwidth intensive translation application. Turned out some backhoe operator hadn’t “Dialed Before he Dug” and had cut right through a fiber-optic line which my server depended on the traffic was being routed through an alternate connection which was did not have nearly enough capacity for the event.
So this got me thinking, what is life like without broadband. I hadn’t used a dialup connection in years, much less used a dialup connection to connect to the bandwidth-heavy Web 2.0 goodness which dominates the current incarnation of the web. I wondered what my AjaxTrans application looked like from the eyes of its dialup users. Whipping out my trusty web-development swiss army knife, the Firefox Web Developer Toolbar, I opened the tools menu to see what was there. Ahh, “View speed report” that looks nifty, I click and this is what I find:
Connection Rate Download Time 14.4K 86.79 seconds 28.8K 43.50 seconds 33.6K 37.31 seconds 56K 22.47 seconds ISDN 128K 7.02 seconds T1 1.44Mbps 0.79 seconds
23 Seconds! That must be unbearable. I quickly read the report to see what I could do to change this enormous amount of loading time, and I saw that it was loading 7 Scripts externally in addition to the images and CSS.
After asking some friends what they would do to alleviate the problem, one suggested that I use two tools:
I flattened the seven scripts into one file, streamlined.js and with one command I was off:
java -jar custom_rhino.jar -c streamlined.js | jsmin > compressed.js
I had reduced the file size by 50%, but I wasn’t quite done yet. I used an old trick from when I did code for dialup connections… gzip. After editing my .htaccess
<Files ~"\.js$">
ForceType application/php
</Files>
I added
<?php ob_start("ob_gzhandler"); ?>
to the beginning of compressed.js and squeezed another 16% size out of it.
The final results:
Connection Rate Download Time 14.4K 26.61 seconds 28.8K 13.40 seconds 33.6K 11.52 seconds 56K 6.99 seconds ISDN 128K 2.28 seconds T1 1.44Mbps 0.38 seconds
The comparasion:

Just under 7 seconds! Yay, I reduced the load time by a factor of pi! How nerdy… well a factor of 3.147 anyways, a 66% size reduction.
You have no idea how much I sympathize with you dialup users.

January 14th, 2008 at 4:37 pm
Good post, thanks. If you already haven’t, also look at YUI compressor - http://developer.yahoo.com/yui/compressor/
February 28th, 2008 at 5:29 pm
A very interesting and informative post. Thanks.
I enjoy using AjaxTrans and my bandwith allows it to function property.
March 18th, 2008 at 11:14 pm
i am gonna show this to my friend, guy
March 23rd, 2008 at 11:19 am
Dojo Toolkit Compressor - An excellent tool!