Kentico Storing my CDN files in \App_Data\AzureCache\library\

SOS Childrensvillages asked on August 14, 2017 11:39

I have CDN configured as per the documentation.

However, when I upload an image, it uploads to the azure CDN but kentico serves the image from \App_Data\AzureCache\library\ when I use the getmedia Permanent URL. Am I doing something incorrect? Should it not be serving the image from Azure?

Thanks in advance

Correct Answer

Trevor Fayas answered on August 14, 2017 15:54

I do not believe so. To explain, first let's distinguish between Azure CDN (Content Delivery Network) and Azure Storage.

Azure Storage is a means of storing files in an Azure repository. When someone requests an image through the GetMedia, Kentico needs to grab the image from the Azure repository in order to modify it. In order to reduce the amount of calls, data transfer, and overall cost it caches the file locally so on later calls it can pull it up, until the cache expires or the file is updated.

Azure CDN works more at determining WHERE it pulls the storage from. It replicates your files across many nodes around the world, so if someone in China requests a file, it can pull the file from from the Azure servers closest to china.

When you use GetMedia, Kentico tries to processes the image first, you may utilize tags like "width" and "height" which mean the server has to download the file, make adjustments, and serve it up to the client. So wherever you site is, that is where the file ultimately comes from, but it pulls locally.

So if your site is in a single spot (Say a dedicated server), this won't give you much performance increase, however if your site is also in Azure and is replicated to different regions, then it will provide a faster service to a degree.

This is why in documentation it states:

Azure CDN can speed up delivery of static content, such as images or stylesheets, as well as streaming media

Static content means you are linking directly to it's path, so the user is getting the content from Azure CDN, not from your website which gets it from the CDN.

Hopefully this helps you understand, i would take the resources you want to be delivered statically and link to them normally (not through the GetMedia).

0 votesVote for this answer Unmark Correct answer

Recent Answers


SOS Childrensvillages answered on August 14, 2017 16:41

Thank you Trevor.

Just to confirm so, I need to manually link to the asset in Azure like so?

https://example.blob.core.windows.net/cmsstorage/library/teaser/test/penguins.jpg

If so, do you know if there any plans in the future to have kentico automatically translate getmedia into azure links or an option to use the azure link instead of getmedia?

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on August 14, 2017 16:46

Correct, that URL would go directly to the Azure CDN and thus present users with the file from the closest CDN.

It is possible to overwrite the rewrite engine to automatically adjust the GetMedia i believe, however be aware that this may affect how the system uses the GetMedia.

https://docs.kentico.com/k10/custom-development/handling-global-events/handling-object-events

https://docs.kentico.com/k10/custom-development/handling-global-events/reference-global-system-events

You should be able to overwrite the URLRewritingEngine.ProcessRewritingResult.Before and from there alter and redirect the user to a different URL. You may have to play around with it and try to find a way to say "Rewrite the URL to azure in these cases, but not these" so you do not affect the system.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.