Phillippe Santana
Phillippe Santana

Reputation: 3116

Should I cache blob content to local HD?

Suppose I have files in blob storage, and these files are constantly used by my web application hosted in Windows Azure.

Should I perform some sort of caching of these blobs, like downloading them to my app's local hard-drive?

Update: I was requested to provide a case to make it clear why I want to cache content, so here it goes: imagine I have an e-commerce web-site and my product images are all high-resolution. Sometimes, though, I would like to serve them as thumbnails (eg. for product listings), and one possible solution for that is to use an HTTP handler to resize the images on demand. I know I could use output-cache so that the image just needs to be resized once, but for the sake of this example, let us just consider I would process the image every time it was requested. I imagine it would be faster to have the contents cached locally. In this case, would it be better to cache it on the HD or to use local-storage?

Thanks in advance!

Upvotes: 0

Views: 383

Answers (2)

Erick T
Erick T

Reputation: 7449

Why not use a local resource? It gives you a path to a folder on the HD, and you can get a lot of space. You can even keep it around between restarts.

Another option is Azure Cloud Drive. It's fast, and would allow you to share the cache among instances (but only can write at once).

Erick

Upvotes: 1

AvkashChauhan
AvkashChauhan

Reputation: 20556

Just to start answering your question, yes accessing a static content from Role specific local storage would be faster compare to accessing it from Azure blob storage due to network latency even when both compute and blob are in same data center.

There could be a solution in which you can download X amount of blobs from Azure storage during startup task (or a background task) in Role specific Local Storage and reference these static content via local storage however the real question is for what reason you want to cache the content from Azure blob storage? Is it for faster access or for reliability? If reason is to have static content accessible almost immediately then I could think of having it cached at local storage.

There are pros and cons of each approach however if you can provide the specific why would you want to do that, you may get much better to the point response.

Upvotes: 1

Related Questions