Over the past couple of weeks, I have been building an Image serving site. The images that are being served are not photos, but more blog images. an example of this is this photo of Steve Jobs and Bill Gates, which was also used in this post:

At the moment, the way the image is hosted is as follows: The image is stored in a SQL server as a binary blob. there is an ASHX handler which does most of the real work. So, the URL for that image is:

http://images.lotas-smartman.net/image.ashx?id=8e9642ef-ff31-4253-93ce-4c79e2484ea5

When you click on it, at the moment (or once the image is requested, like above) the ASHX file checks the requesting client. If it is the Coral Web Cache requester, the binary data is returned. If its anything else, you are redirected to a Coralized version of the image, like so:

http://images.lotas-smartman.net.nyud.net:8080/image.ashx?id=8e9642ef-ff31-4253-93ce-4c79e2484ea5

The problem I have is that something is slow. I cant figure out if it is Coral, or my site, but something is slowing down the loading of the site.

So, a redesign is needed. My thinking is as follows.

Upload an image to the server, as it currently is done (into a SQL DB as a SQL blob).

stick the file into Amazon S3, and insert the new URL into the DB. the same URL (as above, non Coralized) will still work as planed (so I don’t have to fix all images on the site).

If Coral comes a knocking, send on the correct URL (redirect to Amazon S3).

anything else gets redirected to the correct URL too.

The advantage of having pages redirected is simple: tracking and change. I can now have a good count of visitors seeing images, and also check if someone is robbing an image they shouldn’t, and also, if someone comes out with better, cheaper hosting, I can modify the system to use them instead! :)

Now, in theory it shouldn’t be too hard. in practice, well, we will see when I start coding this… heay? :)

Technorati Tags: , , , , ,