bandwidth spikes and cache friendly headers

Graph of Bandwidth Usage for blog.ebrahim.org from October 10 2004 to November 9 2004 I knew while writing my blog entry for the Firefox 1.0 release that I’d see a spike in my bandwidth usage because of the large images I had in my post, but I didn’t expect anything like this! Thanks for dropping by and taking a look! I hope you took the hint and grabbed Firefox 1.0.

According to my pair.com account manager, I pushed approximately 1.1GB of data yesterday, which is more than I’ve pushed before in any single month.

Yesterday, shortly after posting my blog entry, I also set up cache-friendly headers to serve everything under http://blog.ebrahim.org/media/ in a way that doesn’t hit my server too hard. In short, the way it works is that I’ve used the Apache Expires module to instruct clients and caching proxies to cache images for one month from the date of the client pull. That means that if someone on AOL pulls an image from me, for one month, everyone on AOL who tries to pull that image doesn’t touch my server, and pulls it directly from AOL. It’s the next best thing to multicasting. It’s also cool because it reduces server load, because the images don’t generate requests on the Apache server. Not a big issue for me, but huge for those who are load limited rather than bandwidth limited. Here is a sample implementation using an .htaccess file:

ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType video/x-ms-wmv A2592000
ExpiresByType video/mpeg A2592000
ExpiresByType application/pdf A2592000

For more detailed information, the Apache docs have good info for both 1.3 users and 2.0 users. Credit goes to yusufg for hooking me up with the above implementation. One can only wonder what my bandwidth graph would have looked like if every single person who viewed my blog entry hit the graphics.

This entry was posted in Mozilla, Web Hosting. Bookmark the permalink.

4 Responses to bandwidth spikes and cache friendly headers

  1. Steve Chapel says:

    You could also use Coral links for your graphics to further reduce server load: http://www.scs.cs.nyu.edu/coral/

  2. funtomas says:

    Not bad idea. However, not useful for comercial use, where every server hit counts!

    tom

  3. Ali Ebrahim says:

    funtomas, you’re completely missing the point. This is especially useful for commercial use, because this is a way to cheaply minimise bandwidth usage. Companies care about page impressions, not hits on their web server. This is a way to have more page impressions with less resources.

  4. Paul McGarry says:

    Hmmm, it’s a pity this module isn’t enable in a default Apache compile, I could make use of it. I guess I will have to try and remember it for the next upgrade.

Comments are closed.