Wednesday, August 5, 2015

Sitecore media library database storage compared with file system storage

The Sitecore media library is one of the great features available out of the box with Sitecore. Not only does it allow you to keep all media files (images, documents, video/audio etc.) in one place, but they can also be versioned and kept in a clean folder structure similar to Sitecore content items. You are also able to search through the items, which other content management systems may not offer.

By default, the storage mechanism for the Sitecore media library is database - that is the files are all stored in SQL Sever as blobs. However this is a configurable setting and the storage mechanism can be set to file system. Like anything in the development/infrastructure world, there is an argument about which method is best - database or file system. Ultimately the answer depends on that particular implementation and it's requirements; so here are the facts that can be used to make a decision.

Sitecore Media Library - Database Storage

The main benefit here is that there are no physical files to work with. If you have a more complex Sitecore server architecture (with multiple content deliver server for example), then there is the issue of syncing the physical files across servers. Database storage removed the dependency on physical files, so all content delivery servers have the same data source, also it allows syncing of the media across environments (dev, test, production) easy via the use of the package manager or hedgehog TDS.

The main downside here is that as your media library grows the database grows, which can have affects on the resources needed to both run the database server and back it up. Also because it takes .NET code to retrieve and render these images via the ashx handler, the Sitecore servers will also require more resources to work with media stored in the database. 

In terms of file size limitations, you can store large media files (such as video) in the media library. However when you start getting into high traffic, or large numbers of these files, other solutions might be better suited. A video going viral for example, could bring down not only the database, but the Sitecore content delivery servers themselves.

Sitecore Media Library - File System Storage

File system storage can be beneficial in certain situations, especially when a third party content delivery network is involved. A CDN will require actual files so this would not work when using database storage, however there may be development effort required to actually get the CDN working with the images and to have them render from the correct location.

With the files not being stored in the database, the DBMS will require less resources (as it's not storing and processing large amounts of media). Backups of the databases are not as troublesome, and require less storage space. Also there is less potential for data blocking and other issues that may occur in a busy or under-resourced database.


As with any development or architectural consideration, there is never a one size fits all approach that will work every time. In terms of which storage method to use with the Sitecore media library the business requirements need to be analysed to work out which method will work best with a given implementation. This is also an area where future proofing needs to be considered, there may not be many media items now, but if video files will be required down the track; then this will definitely influence a decision. 

No comments:

Post a Comment