Blog Load Time

Posted by Justin on September 20, 2006
Computers, Websites

It’s not often that you think of a home blog as something that you need to work with and make faster and smaller. When I got dugg, I noticed something in the stats that made me shiver. In 6,000 visitors, a tad under 500mb got transfered from my website. The first thing I thought was something was up with the web server - not so. Then, I started looking at things that where downloaded.

From my logs:
Hits: 12 Sep 2006 6001(unique visitors) 10398(pages) 25051(hits) 470.07 MB(bandwidth)

Traffic from my entire web server that day was 570Mb…

Now, breaking down the bandwidth, I listed the following as the highest offender:

Bandwidth: Jpg Image(type) 11852(hits) 490.34 MB(bandwidth) 82.8 %(bandwidth)

So, after 6000 unique visitors, roughly 83% of my bandwidth was from JPG images. The largest image downloaded from my web space turned out to be a page header that served as the background in my current WordPress theme (The road picture on top). Somehow, the theme creator managed to sneak a 189Kb image into the mix of other images. Wowzers. Anyone not on broadband would suffer just a tad while waiting for that thing to load. Oddly, Alexa shows that the page loads fast (Speed: Very Fast (95% of sites are slower), Avg Load Time: .4 Seconds). I’m guessing Alexa doesn’t take images into account, just server response time.

Concerned?
Bandwidth costs money, that was the primary reason I was concerned. After 6,000 visitors on a website, you’d figure someone wouldn’t be concerned, but happy. Anyone that runs a website can see why I would be worried about the size of a graphic. Picture getting dugg on the main homepage of digg or even getting slashdotted. That could quickly become a realistic 1Million plus hits in just a few hours. (Note: Slashdotting normally causes webservers to crash or causes all available bandwidth to be eaten up within minutes.) That means that the measly 400Mb of data I transfered in one day could quickly become tens of gigs, all mostly due to one graphic. That could mean a hefty bill at the end of the month. I’ve personally seen where people have gotten bandwidth bills for several thousand dollars, and they had to pay for it.

What To Do
The quick answer was to download the graphic and re-saved it in an optimized format. After comparing the first two images, 49Kb is much better than the original in size and it looks the exactly the same. After doing this, my page load time went from .4 seconds to .14 seconds, that should say a lot right there.

Every web master should look over their stats on at least a weekly basis to see if something is wrong. Without looking at the stats, you don’t know where your traffic is coming from, how much traffic you’re getting, etc. To help with all of this, Google has also created the Google Analytics, which is a fancy, Google branded, Urchin stats page that is free for websites that get under 5million hits a month. It measures everything from generic traffic to page load times to the resolution of the visitors. If you don’t like looking at bare stats, Google Analytics does a very good job. Its honestly the best stats engine I’ve seen.

Later on, I think I’ll work on a plugin to detect Digg’s, Slashdot’s and other oddities that happen and refer them to a special text only page, depending on CPU usage. I may create my own from scratch or hack together something from an existing cache plugin - we’ll see. Either way, my situation wouldn’t have warrented such an activation since CPU usage barely got spiked. I’ll check around to see if there are any plugins that fit what I require (ie: full cache, redirection to graphicless pages, etc…)

Other Issues
There are other issues that can cause your blog to slow down as well. As a for instance, I sometimes embed YouTube videos into my content. Needless to say, this really slows down the loading time of everything, but can make the blog pretty neat.

External Javascript, image calls, etc can slow down things as well. Think things over before you install some javascript and if you can, you need to look over the source to ensure that its not calling info or placing info on other sites.

I currently have Google Images and Advertisements as well as a Technorati javascript. On each sub-page (full story view), I have software that tracks links back to the original place and I have a DIGG notification that tells me whenever I get Dugg. Its nice to get an email anytime you’re mentioned on a bigger website.