Con risposta Image ina folder or in a database

  • 2012年4月16日 6: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?

全部回复

  • 2012年4月16日 7: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

  • 2012年4月25日 3: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

    • 已标记为答案 marck68 2012年4月25日 7:01
    •