Overages and Underages: Website Bandwidth April 28th, 2010
While perhaps containing a not-so-real word, this blog’s title touches on a subject of confusion for some webmasters and web developers. The gray area comes to us in the form of web statistics as they relate to resource usage. In particular, this seems to apply to bandwidth usage. The confusion sometimes results in anxious tickets and begs the question: Where did my bandwidth usage go?
While not always an exactly obvious science, understanding your website’s traffic is not as difficult as it may seem. Perhaps the best (and most simple) tip when dealing with bandwidth traffic is to go directly to your statistics programs: AWStats and Webalizer. There are certainly other alternatives such as pouring over log files and third party statistics, but both these programs now come with both cPanel and DirectAdmin.
AWStats probably works more for examining page size and overall file sizes. Take a look under the Navigation: heading to see several links. The first is File Type, which shows the files that are visited on the site and their overall size contribution to bandwidth per the type of file. In my below case, PHP and HTML files account for the majority of the bandwidth (as they generally should) at over 6GB total. Notice the image type designations: PNG, JPG, and GIF. Depending on the nature of a site, images can be the largest bandwidth hog:
For example, take a given index page where a couple personal pictures have been uploaded for something like a business celebration or charity event. The size of the image will mean everything; if the pictures range in size from 2MB (2,048KB) to 3MB (3,072KB) and you have five images posted, you’ll use 10MB to 15MB each time that page is visited. (Now keep in mind we’re not dealing with caching, etc. here…) If you multiply that out with 200 unique visitors (10MB/page * 200 unique visitors), your website used 2000MB of bandwidth – or what amounts to just under 2GB. If that jumps to 1000 visitors, your website has now used 10GB of bandwidth. This, of course, does not include other items on the page. This simple example should illustrate how a few images or files can change the game. If you scroll on down one more section in AWStats, you can view the actual pages loaded, which plays into the next part of the discussion.
This is where Webalizer comes into play. Webalizer lists (in detail) the most visited pages (and files) on the website. Scroll down roughly half way in Webalizer and you’ll see a headline: Top 30 of xx,xxx URLs. Now the latter number will vary per site, but the title should provide a hint as to what information is provided. The section just underneath this one is helpful as well. Here you can see what individual files might be contributing to bandwidth consumption.
Aside from legitimate image consumption, often illegitimate image linking (aka hotlinking) account for the other major chunk of surprise bandwidth usage. Hotlinking is when another site links to your image. While not always carried out with malicious intent, this practice can have malicious results. This trend can be identified by heavy image bandwidth consumption or if images on less prominent pages are suddenly loaded often. If hotlinking is the issue, you will notice images listed in the Webalizer pages at the top with lots of hits and KBs used. To alleviate this, cPanel provides a feature to disable hotlinking or you could simply deny the offending site(s). If you disable hotlinking completely, then no one can link to your images off your website. For you DirectAdmin folks, you have to get your hands dirty in .htaccess and the tutorial at this link provides more information.
The goal is to understand more about where your website’s bandwidth is going in simple terms. These few simple steps can answer many questions and help you tweak your website to stay in budget or load quickly. As always, if you need the help, our helpdesk is a short email or ticket away.