Image Hosting Azure - azure

I'm creating a website where users will be able to upload various images when creating a new page on my website. What service does Microsoft offer to host many user uploaded images. Would a Blob suffice? If so, if I were to add a CDN, would it be worthwhile? From what I understand, a CDN copies the images on various servers. If my local server has 1 million images, would that mean all the other locations will have 1 million images as well? Would that be very costly?

Blob storage is the perfect place for images in Azure.
CDN is great for when your images are at least somewhat static and will be viewed more than once.
With CDN you do not pay for storage costs (on the CDN), but instead for transfers out of the CDN - http://azure.microsoft.com/en-us/pricing/details/cdn/
I should also mention that if you're using Azure and Blob storage is your primary facility for storing images, Azure's CDN does not have to be your primary CDN - and any CDN will work. CDN's are pretty commodity service these days.
HTH

A CDN on top of Azure storage would be useful if you have lot of users fetching the same file(hot files/Cache hits) Accessing files that are not heavily used will result in a Cache Miss. The CDN will then fetch the file from the origin (Azure Storage) before delivering it to the user. For such a scenario adding a CDN on top of Azure storage provides very little benefit.

Related

Move existing images present in Media folders of Orchard to CDN

We have an existing site that uses Media folder of Orchard to store images, and being used heavily in web pages. Now we want to share the Media folder to be shared across two different Web Apps(one is production site and the other is a Staging).
In some of the cases where content developer adds an image to site, it is actually stored on the file system in the production, but we miss these images in our Mirror site, so we have to do a manual copy.
Currently we are thinking to store the media files in Azure blob storage, so that I can share the images between Production and Staging, had anyone that? if yes, please share your thoughts
Any other ideas?
You need to use the Microsoft Azure Media Storage module to enable storing the assets in Azure Blobs.
There is a setup process for this described in docs.
The connection string will happily work shared between multiple projects.
If you have tenants then they can have their own isolated Storage accounts as well (and therefore their own custom domains).
When you enable it though it won't automatically copy the existing assets over to your Azure Blob Storage. I think there is a tool called AzCopy which you can use to move files in and out of cloud storage.
FYI although it is a kind of CDN, by default Azure Blob Storage is just stored in one data center, replicated 3 times. There is actually a different product offering on Azure for a true CDN if you want it to be replicated to points around the world to speed up asset delivery for global users but that doesn't seem to be what you're looking for based on your original question.
Sharing a blob storage with media between production and staging just works.
I regularly copy my production site to my local machine and run the site locally and see all images.
Maybe watch out that you only add images add the production site, not sure which references there are to the file in the Orchard Database.
Have a look in the database, or just try it out and let us know.

Can you use Azure CDN without having to upload the files to Azure storage?

I have a website where I would like to cache the few images/stylesheets/javascript-files I have. Is it possible to have Azure CDN point directly on the files on my server, and then cache them, instead of having to upload them to an Azure storage?
It's not possible. Azure will not allow you to configure arbitrary domain as origin domain to support origin content pull. The only available targets are existing azure website, cloudservice or storage account.
Let us discuss your desired end goal.
If you want to improve your caching with CDN related functionality with the same domain name, take a look at Cloud Flare.
However, if you were going to a separate your content into a CDN domain and the application domain, you could look at expanding the following MSDN sample. The idea with this sample is so that as a deployment step, you upload all the CDN related content to the Azure Storage Account.
https://code.msdn.microsoft.com/windowsazure/Synchronizing-Files-to-a14ecf57

Strategy to minimize Azure storage outbound data costs

I am building a web site that (among other things) allows the user to upload photos via web api. The user images will be stored in azure storage blob to be displayed in user albums, and shared with social media. The site will be hosted as an azure web site. I am eager to minimize data transfer costs. I understand that data transfer between an azure web site and table/blob storage incurs no data transfer charge (as it is not considered "outbound") while and data requested from outside the azure web site does. In response to this, I have 2 strategies for exposing the images to the browser:
1.) Via the URI to the image blob in azure storage e.g. with local storage account http://ipv4.fiddler:10000/devstoreaccount1/bcb2ad7581.jpg
2.) Via web api that downloads the image bytes from storage and returns them. e.g. with local host http://localhost:58559/api/image/bcb2ad7581.jpg
These are my assumptions. The direct to storage access (method 1 above) is more efficient. Accessing the images via web api (method 2 above) must incur overheads that the direct access doesn't, right? Each web api request must consume an asp .net thread plus cpu cycles. For each web api image request processed, that is one less request for other web api resources on the site that cannot, and must be queued. On the other hand any external site the image is shared with would add a data transfer cost (among other costs) for each image request; if accessed via method 1.
So my strategy is to access the images within the site via a direct link to the storage (method 1) e.g. when the user opens an album all tags have azure blob uri in their src attribute. However when the user clicks on the Facebook icon to share, I will provide a link to the image via web api (method 2). I realise the user can bypass all of that with plugins like the "PinIt" button etc, but that's OK.
I am only learning this stuff, so I could be way off.
Am I wrong about outbound transfer costs not being applied to azure web sites? I don't think I am but the whole pricing model is confusing, to say the least.
Is accessing blob storage from a browser html page with tag and src atribute, considered outbound data transfer; even if the html page comes from an azure website domain? I mean is it only free when the server side code accesses the storage, not the html client?
Is any data transfer cost saved via method 2 (if indeed there is one), simply cancelled out by a different cost associated with the web api method (like bandwith cost)?
Am I wrong about the performance benefit of direct access to the blob storage, or possibly wrong about the overhead of the web api requests?
It is early days in the design, so I can dump Azure if I have to. I would rather not though, as I think it is what I'm looking. I don't want something for nothing and am happy to pay for the services I consume. Naturally, though, I don't want my ignorance to cost me.
I could do with your advice, on this, and truly appreciate your help.
To answer your questions:
Am I wrong about outbound transfer costs not being applied to azure
web sites?
Sadly, Yes :) Any data that goes out of an Azure Datacenter (DC) incurs an outbound transfer cost and that includes data served through your websites.
Is accessing blob storage from a browser html page with tag and src
atribute, considered outbound data transfer; even if the html page
comes from an azure website domain? I mean is it only free when the
server side code accesses the storage, not the html client?
Yes. Remember the browser is consuming the data which is sitting outside of Azure DC.
Is any data transfer cost saved via method 2 (if indeed there is one),
simply cancelled out by a different cost associated with the web api
method (like bandwidth cost)?
No. Because data eventually flows out of Azure DC (doesn't matter if it is via storage directly or via web api).
Am I wrong about the performance benefit of direct access to the blob
storage, or possibly wrong about the overhead of the web api requests?
You will certainly get more performance benefit by providing direct access to the blob storage than transferring data through web api. Plus you will increase latency as well.
Solution Recommendation
For your application, may I recommend that you look at Shared Access Signature functionality offered by Azure Blob Storage. I believe this will significantly improve the performance of your application.
For uploads, you could create a SAS URL will upload permission and have your web application directly upload files in blob storage. That way the upload data won't be routed through your servers. I wrote some blog posts on the same which you may find useful:
http://gauravmantri.com/2013/02/16/uploading-large-files-in-windows-azure-blob-storage-using-shared-access-signature-html-and-javascript/
http://gauravmantri.com/2013/12/01/windows-azure-storage-and-cors-lets-have-some-fun/
For downloading images, again have your Web API return a SAS URL instead of reading the image data from blob storage and then stream that data back to the client browser.

Can i upload to CDN server directly in Azure?

I have been exploring the features available in Azure and AWS. The fact that most features is not available or not clear.In CDN part i have comparisson criteria like 'Whether I can push/upload content to CDN Servers like in AKamai.
I have seen the feedback program and find that Custom-Origin is not available(
Link : http://feedback.azure.com/forums/169397-cdn/status/191761 ).But this one i could not find any link.Anyone has any idea?
No. Azure CDN currently does not support direct interaction (i.e. direct content upload, explicit or on-demand content expiration, etc.). It works as advertised serves files from Azure Storage Account or azure Cloud Service.

Does CDN support video caching?

I am new Windows Azure and I uploaded all my images into CDN.
It provides In-Memory Cache that can store my application's data in memory to improve application responsiveness, performance and scale.
And also I upload my preview video content into Azure CDN but my application player doesn't play this video url which likes http://cdn.mydomain.com/myapp/videos/preview/1460_preview.mp4
Do you know any idea ? How can I serve this content via Azure CDN.
Thanx
Azure CDN is a 'pull' model & not a push model. You don't upload into the CDN, you would upload into Blob storage or onto a VM's storage in the /CDN virtual directory. On the initial request the CDN would grab the file from origin and populate the edge node. The second request would be served from the CDN.
The CDN does support video files & a variety of streaming codes.
Overview of CDN:
https://azure.microsoft.com/en-us/documentation/articles/cdn-overview/
Best practices:
http://blogs.msdn.com/b/windowsazure/archive/2011/03/18/best-practices-for-the-windows-azure-content-delivery-network.aspx
Another way to do this is to leverage the Azure Media Services:
http://www.windowsazure.com/en-us/develop/Media-Services/how-to-guides/media-services-dotnet/#enable-cdn
Pat

Resources