BLOB Caching in SharePoint 2013

BLOB Caching!

Dealing with large media files? Like large images, videos, audio files? Are you having large CSS files and huge JS files to be stored and you think these files are eating your space and is also hindering your performance? Then BLOB caching will come as a savior. Let us understand our savior (BLOB Cache) in more detail.

What is BLOB Cache?

Let's start with the full form of it BLOB: Binary Large OBject. Having stated that, it's clear that a BLOB cache type will enable us to cache file types that are large in size. For example, media files, CSS files and so on. A BLOB cache will store the frequently used large files on the Web Front End Server's directory. This will ensure less traffic to the database servers. For this we will must enable the BLOB Cache on the Web Front End Server.

Apart from caching the large files, BLOB Cache supports other features like:

  • Byte-range requests: Pause and play and starts the video from half and plays.
  • Progressive Caching: Plays the video that is cached while the rest of the part will still be cached.
  • Dividing the Video Files: Configures the size of the Video file division that will load the video in sections.

Note: If you are using Image Renditions, then BLOB Cache is the pre-requisite.

We can select the file types to be cached while configuring the BLOB Cache.

When to use a BLOB Cache

A BLOB Cache is recommended for the sites that:

  • Have heavy traffic
  • Maximum anonymous users
  • Most of the contents are static contents.
  • The image renditions feature is being used.
  • Has many ready-only Media assets.

Best practices around BLOB Cache

  • A drive where the BLOB cache must be stored should have sufficient disk space.
  • Ensure the selected drive should be accessed by only a few processes.
  • ULS Logging and BLOB Cache should be in separate drives.
  • The maximum size should not be less than 10 GB, that is the default size.
  • The maximum size of the BLOB cache should be 20% more than the expected growth.  

How to enable BLOB Cache

  • BLOB Cache can be enabled in the Web.config file of a SharePoint 2013 Web Application.
  • It  is not set by default.
  • You should be the member of the Administrators group of the Web Front End server on which you are configuring the BLOB Cache.
  • Click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager

    IIS Manager
  • In the Internet Information Services (IIS) Manager, in the Connections pane, click the plus sign (+) next to the server name that contains the web application and then click the plus sign next to Sites to view the web application or applications that have been created. 

    Connections in IIS Manager
  • Right-click the name of the web application for which you want to configure the disk-based cache and then click Explore. Windows Explorer opens, with the directories for the selected web application listed.

    Exploring Web App in IIS Manager
  • Right-click web.config and then click Open

    WebConfig of Web App in IIS Manager
  • If Visual Studio is installed in your Web Front End then it will open in Visual Studio automatically.
  • If not then you will need to open it in a text editor such as Notepad using the following steps:
    • If the Windows dialog box appears, select Select a program from a list of installed programs, and then click OK.
    • In the Open With dialog box, click Notepad, and then click OK.
  • In the web.config Notepad file, find the line: <BlobCache location="C:\BlobCache\14" path="\.(gif|jpg|jpeg|jpe|jfif|bmp|dib|tif|tiff|themedbmp|themedcss|themedgif|themedjpg|themedpng|ico|png|wdp|hdp|css|js|asf|avi|flv|m4v|mov|mp3|mp4|mpeg|mpg|rm|rmvb|wma|wmv|ogg|ogv|oga|webm|xap)$" maxSize="10" enabled="false" />

    Web Configuration File
  • In this line, change the location attribute to specify a directory that has enough space to accommodate the cache size.
  • To add or remove file types from the list of file types to be cached, for the path attribute, modify the regular expression to include or remove the appropriate file extension. If you add file extensions then make sure to separate each file type with a pipe (|), as shown in this line of code.
  • To change the size of the cache, type a new number for maxSize. The size is expressed in gigabytes (GB), and 10 GB is the default.
  • To enable the BLOB cache, change the enabled attribute, from "false" to "true".
  • Save the Web.config file and then close it.
  • This will reset your IIS.  


Up Next
    Ebook Download
    View all
    View all