At my day job we recently ran into a conundrum with our hosting provider. Our website was using more bandwidth than we had contracted for and we were having to pay overage fees. I took it upon myself to look into our bandwidth consumption and try to find ways to reduce it, and hopefully save some money in the process.
The first thing I did was have a look at our IIS web logs. Considering we get about 20,000 page views a day, parsing the raw logs was somewhat arduous. We use and love Google Analytics for our web stats, but it doesn’t provide the information I was looking for; specifically which files (js ,css ,jpg, whichever) were the most responsible for bandwidth transfer. Basically, what are the biggest files that get requested the most often. I imported the logs into an analytics program and pored over the results.
What I keyed in on were a couple of scenarios:
1) The main header graphic for our site was large at almost 100KB, it was included on every page, and it was a png. I had our graphics guy convert the file to a jpg at a slightly lower quality and he got it down to 20KB. An 80KB per page savings.
The next and last thing I did is something that everyone should do. I enabled gzip compression in IIS. Gzip is a form of compression based on the deflate algorithm that can reduce the size of text markup by up to 75%. All modern web browsers decompressgzip on the fly, so the end result is not only reduced transfer size, but also increased speed. I’ll go over how to enable gzip compression in a future post.
At the end of the day we were able to reduce our bandwidth consumption by about 25% (which for us was roughly 100GB a month).
For more tips on increasing the speed of your site and reducing bandwidth check out http://code.google.com/speed/.