If using a CDN in Azure in relation to a website/webapp (i.e an Azure application service), what are the benefits/drawbacks of using blob storage vs just using the web application as the endpoint?
For example, a simple CMS website stores all uploaded images in /uploads/myimage.jpg
Using the CDN I could set its endpoint at mywebsite.com/uploads/ or I could create a blob container, set the CMS to store the images there and set it as the origin for the CDN.
What are my considerations for choosing one over the other?
As Rob stated in his answer, there's not much difference, performance-wise. Here are what I consider the core differences, overall, between web app-backed CDN and blob-backed CDN:
- With first-hit of an object (or the hit after the cache has expired), Web App-backed CDN will have that traffic route through your web app initially. If it is a very large resource (e.g. video file), it's possible that you'll notice an intermittent performance drop due to bandwidth being consumed in an unusually-high manner (until this object is cached in CDN). Blob storage doesn't have the same type of bandwidth limits.
- with Web App-backed CDN, you have to remember that your storage is limited by the Web App tier you've chosen. If you have 10's of GB of assets, for example, this could force you into a higher tier. With Blob storage, you'll have 500TB of total durable storage, with objects sizeable up to 4.77TB.
- Web Web App-backed CDN, the storage residing in your web app is durable, just like blob storage, until you delete your Web App. Then that storage is gone. With Blob storage, your storage would remain, even after deleting a Web App (or an entire App Service). Of course, your objects would disappear if you deleted the Storage Account...
- If you have assets that are needed in multiple web apps (or other apps hosted elsewhere), you will start to have links from one app, pointing to the assets of another app, introducing a dependency (e.g. web app
A
with css links to content in web app B
). You'd need to carefully manage that. Or store common assets in blob storage and avoid app-to-app linkage dependencies.
- Blob storage would give you the option of locating your static assets in a different region than your web app. With web app storage, they'd always be colocated. (I'm not advocating separating content across regions; just pointing out the flexibility to do so).
- Content management for Blob storage can be done in many ways: Direct REST API calls, SDK-based calls, and many 1st- and 3rd-party tools. With Web App content, there are no such APIs and tools; you'd either have to deploy assets along with your code, or copy content from another source (e.g. blob storage) upon startup (or manually, or via scripts, or however else you choose).