If you’ve ever worked with Sitecore, you know that it comes with a Media Library for storing images for display on the website and other files for download.

Images get stored in SQL database in their binary form which can take up a lot of storage space over time. Storing images in the database means retrieving them takes a lot of processing power and adds latency to the time taken to display them on the website.

To enhance performance, rather than retrieve images and other files from the SQL database, Sitecore stores these files in a cache.

Where does the cache live?

On the file system and not in memory. It is important to take this into consideration when building out the hosting infrastructure in an IaaS solution and ensure that there is enough storage space as it expands over time.

Fortunately, the path to the Media.CacheFolder store is configurable (like just about everything in Sitecore), and it doesn’t need to be inside the App_Data folder of the web root or even on the same drive.

In Azure PaaS by default the Media Files store is set to D://local/MediaCache, which is great because it’s not on the C: drive but problematic in that you can’t access it via Kudu, the file system navigator provided by Azure. As I mentioned above, the path is configurable, so it is possible to change it just note that by default you won’t be able to browse the files.

It’s great that it’s cached for performance but how can you expire the cache and ensure you get the latest version of a file?

You can change the default cache purge settings which are set to 90 days by default but that is going to affect performance and still might not give you the update frequency you need.

What about in an emergency?

Well, Sitecore’s cache admin page won’t help you here, it only deals with in-memory cache. You would have to write some custom code to clear it on an ad hoc basis or clear it manually by logging in to the server and deleting the files. If that doesn’t sound ideal, it shouldn’t…

Sitecore has a setting that appends the Version Id to the querystring, delivering the latest version of the asset to the user. For some reason the Media.AlwaysAppendRevision setting, introduced in Sitecore 8.2+, is set to false by default – it does make the URLs less pretty but seems like it is something that the majority of sites would benefit from and should be configured via a patch file to be true.

So that’s the basics of the Media Library and some tips on how to manage performance and settings.

Want to improve site performance and load times even further? It’s as easy as CDN.

If you really want to reduce server load and increase site performance, getting a Content Delivery Network (CDN) in place for your images and files is the way to go. Sitecore works well with many CDNs and provides easy integration. It’s an easy step to take that will benefit your users and potentially reduce the costs of hosting your site with the offset on bandwidth usage but YMMV.

However, if your company is heavily reliant on image assets or uses images in print catalogs, across multiple systems, or shares them with branding agencies or journalists it is probably time to start thinking about a DAM if you haven’t got one in place already.

So many DAM options but which one to choose?

There are many Digital Asset Management (DAM) products available in the marketplace and some have connectors to Sitecore. Recently though I’ve heard of vendors no longer providing support for their Sitecore connectors, which means you either have to rely on in-house skills to keep it functional or a partner like Perficient to create and maintain that for you.

This change is possibly because of Sitecore’s own DAM product, a part of Content Hub, entering the marketplace making it the obvious choice for integration where your company isn’t already invested in another DAM, and even then, the cost of switching might prove worthwhile in the long run.

As Content Hub is modular, it provides more than just a DAM but when it comes to images and asset management the DAM portion is all that is required, and the DAM provides an underlying Azure CDN for serving content so the performance benefits are built in.

Perficient is a Content Hub Specialized Platinum Partner and you can find out more about Sitecore’s DAM offering on the Sitecore website.