Media file hosting change

I've always hosted this website and a few siblings on my home machine over a slow DSL link (384kbps outgoing speed). This is fine for the text, but for images it's not the greatest---a 3 megabyte jpeg would take about a minute, and that's if you're n competing with anybody else.

A few years ago I toyed with the idea of moving my website hosting to dreamhost, an inexpensive web host with generous bandwidth and storage limits, but found that my blog software is not well-optimized and performed poorly on the shared hosting machines at dreamhost. I toyed with caching schemes but never did get it working to my satisfaction.

This weekend I tried a new idea: host the media files on dreamhost, but run the cgi on my home system. This turns out to be really simple: from time to time, rsync all the media files from the home system to dreamhost, and update a timestamp to reflect when the last rsync was. When building the link to one of the files, check if the local file is older than the timestamp. If so, form a URL to the media site. Otherwise, form a URL to the local site.

So far the results look good; when loading a photo-heavy page from outside my house the page is complete in a fraction of the time.

Entry first conceived on 1 December 2008, 14:41 UTC, last modified on 15 January 2012, 3:46 UTC
Website Copyright © 2004-2017 Jeff Epler