Ryan van der Kooy's Dev Blog

Using Distributed Caching for Images

So i've been toying with the idea of using either MS Distributed Caching (Project Velocity) or Memcached to cache images on the server.  Basically, i have a windows forms app (or eventually a windows service) which grabs frequently used images from disk, does any necessary graphics processing on them (adding transparencies, etc.) then sends them into the cache.  I then have a wcf REST service that, when accessed, first checks the cache for the image and if found, returns the image as a memorystream.  If the image is not in cache, then obviously it grabs it from disk and sends it as a memorystream. 

 Advantages

1.  Image locations are encapsulated behind a service.  Client code (silverlight) does not need to be updated if the image locations change/move.

2.  If a requested image does not exist, a generic "Image not available" image can be returned without crashing a silverlight app.

3.  Thumbnails can be generated on the fly in GDI.

4.  Caching in memory is fast.

5.  Images can be used for RSS feeds.

 Disadvantages

1. Pulling from disk into memory through GDI may (probably does) cause overhead.

2......please add comments with more advantages/disadvantages.

 

This idea may be worthless and pointless and may ultimately slow things down.  but i can't stop thinking about it and it would be nice to get some final closure as to whether or not it is worth it.  I need to figure out a way to accurately do time-tests.  I'll post what i find. 

Posted: Aug 10 2008, 03:28 PM by rvanderkooy | with 4 comment(s)
Filed under: , , ,

Comments

Using Distributed Caching for Images - Ryan van der Kooy's Dev Blog said:

Pingback from  Using Distributed Caching for Images - Ryan van der Kooy's Dev Blog

# August 10, 2008 4:22 PM

carnewsservice.info » Using Distributed Caching for Images said:

Pingback from  carnewsservice.info » Using Distributed Caching for Images

# August 10, 2008 4:49 PM

flalar said:

Hi there... Not exactly sure why you wanna put the images in the cache instead of leaving them on the disk... If the bottle neck in your app is disk IO then sure. However that is seldom the case. Hence I recon you will just be introducing more complexity into you system.

Cheers!

# August 11, 2008 10:25 AM

Jeff Paul Internet Business said:

Great post! My firm does internet marketing for companies and so a lot of my e-newsletter, blog and seminar content revolve around for promotion. Thanks!!!

# March 4, 2009 12:07 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)