Image ina folder or in a database
-
lunedì 16 aprile 2012 06:56
Hello
On azure is it better, in term of performance, to store images in a database or in a folder
in particular when we have a large number of images?
Tutte le risposte
-
lunedì 16 aprile 2012 07:25
Hi,
You should use the blob storage to store images. This will give you the best performance and the lowest cost compared to database.
- Database: Expensive, doesn't scale that easily
- Local folder: Not persisted (if your machine is deleted, so is your data)
- Blob storage: cheap, very fast, will increase performance of your website (you'll be loading data from different domains)
Sandrino
Sandrino Di Mattia | Twitter: http://twitter.com/sandrinodm | Azure Blog: http://fabriccontroller.net/blog | Blog: http://sandrinodimattia.net/blog
- Proposto come risposta Sandrino Di Mattia lunedì 16 aprile 2012 07:25
- Contrassegnato come risposta marck68 lunedì 16 aprile 2012 07:54
-
mercoledì 25 aprile 2012 03:55
The right answer really depends on the nature of your application--particularly on how often a given image is accessed by both users and the application.
From a performance perspective, you're generally better off using blob storage. Blobs also have the advantage of being easy to connect with the CDN.
However, from a cost perspective, if your images are accessed frequently, you might be better off putting them in a database. There's a cost in blob storage both for the amount of data stored, and per-transaction. Transaction fees are "only" $0.01 per 10,000, but they can add up surprisingly fast (for example, if you periodically scan the files to determine counts, sizes, names, new content, or something like that). In the DB, it's only based on the space used; no per-transaction fees.
Another option is to use either blob storage or the DB as your primary store, and use local Windows Azure storage as a cache. For blob storage as the primary, after the initial transfer, there wouldn't be any additional per-transaction fees. For SQL Azure as the primary, it would be slower than blobs on first access only.
Check out my book: Ultra-fast ASP.NET: Building Ultra-Fast and Ultra-Scalable Websites using ASP.NET and SQL Server
- Contrassegnato come risposta marck68 mercoledì 25 aprile 2012 07:01

