Blob Cache in SharePoint Tutorial

This SharePoint tutorial, we will discuss how we can improve the performance of a web site using Blob Cache in SharePoint. Also, we will discuss how to enable BLOB CACHE to use in Image Radiation in SharePoint 2013 and how to configure remote blob storage in SharePoint.

There are also different types of other cache like Page Output Cache, Object Cache, etc.

Blob Cache in SharePoint

BLOB (Binary Large Object cache ) is a disk-based cache in SharePoint. By this technique, the data is stored on the Hard-Disk of the Web Front End Server. Here the first call will fetch the data from the server and stored in Web Front End Server. And for any further calls for the same data, the data will be retrieved from the cache version.

Blob Cache in SharePoint 2010 is a very good feature for SharePoint site performance.

This feature improves the performance of your solution when there is a larger number of concurrent users accessing a small number of large files.

This feature decreases the number of data requests from SQL Server, making data immediately available to users because a copy of these files is stored in the WFE server cache.

This copy is generated when some content is requested by a user for the first time, and remains stored in the WFE server’s disk cache until that content is modified, or when cache configuration settings will consider that expired.

You can store different type of data like images, audio, video etc.

By default the BLOB cache is turned OFF, we have to configure in web.config file of the web application to turn in ON.

To configure this Open the web.config file of the web application and search for:

<BlobCache location=”C:\blobCache” path=”\.(gif|jpg|png|css|js)$” maxSize=”10″ enabled=”false”/>

And modify like below:

<BlobCache location=”C:\blobCache” path=”\.(gif|jpg|png|css|js|MP3|WMV)$” maxSize=”5″ max-age=”3600″ enabled=”true” />

Here

  • Location: Where you want your cache will be stored.
  • Path: The type of data to cache.
  • MaxSize: The size in GB of the cache
  • Max-Age: Maximum time in Cache in seconds.
  • Enabled: Parameter to enable.

Enable BLOB CACHE to use in Image Radiation in SharePoint 2013

Now, we will discuss, how to enable BLOB CACHE to use in Image rendition in SharePoint 2013.

A new concept to SharePoint 2013 is image renditions. The basic purpose of image renditions is to offer differently sized versions of images uploaded into SharePoint. To take advantage of this useful feature, you need to be working on a site with publishing features enabled, and also have BLOB caching enabled for your web application.

1- Go to the following directory: C:\inetpub\wwwroot\wss\VirtualDirectories.

2- Open the folder of the web application in which BLOB caching will be enabled.

3- Create a backup copy of the web.config file. This is always recommended if you ever need to edit or modify this file, so you can always revert back in the event that something happens.

4- Open the web.config file in Notepad or another editor. Press Ctrl+F to open the Find dialog and type <BlobCache. Press Enter to perform the search, which brings up the following 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" />

At the end of the line, change enabled=”false” to enabled=”true”.

5- Save the web.config file. Now you can use the image radiation feature on your site.

Configure Remote Blob Storage in SharePoint

Now, we will see how to configure the Remote Blob Storage in SharePoint.

In SharePoint Server, a binary large object (BLOB) is a large block of data stored in a database that is known by its size and location instead of by its structure: for example an Office document or a video file.

By default, these BLOBs, also known as unstructured data, are stored directly in the SharePoint content database together with the associated metadata, or structured data. Because these BLOBs can be very large, it might be better to store BLOBs outside the content database. BLOBs are immutable.

Therefore, a new copy of the BLOB must be stored for each version of that BLOB. Because of this, as a database’s usage increases, the total size of its BLOB data can expand quickly and grow larger than the total size of the document metadata and other structured data that is stored in the database.

BLOB data can consume lots of space and uses server resources that are optimized for database access patterns. Therefore, it can be helpful to move BLOB data out of the SQL Server database, and onto commodity or content-addressable storage.

The user account that you use to perform the procedures that are described in this document must have the following memberships:

1. Administrators group on the Web servers and application servers.

2. SQL Server dbcreator and securityadmin fixed server roles on the computer that is running SQL Server 2008.

After this Following the step:

A) Enable FILESTREAM on the database server

1. On the Start menu, point to All Programs, point to Microsoft SQL Server 2008 R2, point to Configuration Tools, and then click SQL Server Configuration Manager.

2. In the list of services, right-click SQL Server Services, and then click Open. See in fig

install and configure rbs with sharepoint 2013 and sql server 2014
install and configure ribs with SharePoint 2013 and SQL server 2014

3. In the SQL Server Configuration Manager snap-in, locate the instance of SQL Server on which you want to enable FILESTREAM.

4. Right-click the instance and then click Properties.

5. In the SQL Server Properties dialog box, click the FILESTREAM tab.

6. Select the Enable FILESTREAM for Transact-SQL access check box.

7. If you want to read and write FILESTREAM data from Windows, click Enable FILESTREAM for file I/O streaming access. Enter the name of the Windows share in the Windows Share Name box.

8. If remote clients must access the FILESTREAM data that is stored on this share, select Allow remote clients to have streaming access to FILESTREAM data.

9. Click Apply. See in fig

remote blob storage sharepoint 2013
remote blob storage SharePoint 2013

We can begin to configure Filestreaming for SharePoint. Follow the step –

1. In SQL Server Management Studio, click New Query to display the Query Editor.

2. In Query Editor, enter the following Transact-SQL code:
EXEC sp_configure filestream_access_level, 2
RECONFIGURE

3. Click Execute.

B) Provision a BLOB store for each content database

1. Click Start, click All Programs, click Microsoft SQL Server 2008, and then click SQL Server Management Studio.

2. Connect to the instance of SQL Server that hosts the content database.

3. Expand Databases.

4. Click the content database for which you want to create a BLOB store, and then click New Query.

5. Paste the following SQL queries in Query pane, and then execute them in the sequence listed.

use [WSS_Content]
if not exists (select * from sys.symmetric_keys where name = N'##MS_DatabaseMasterKey##')create master key encryption by password = N'Admin Key Password !2#4'

use [WSS_Content]
if not exists (select groupname from sysfilegroups where groupname=N'RBSFilestreamProvider')alter database [WSS_Content] add filegroup RBSFilestreamProvider contains filestream

use [WSS_Content]
alter database [WSS_Content] add file (name = RBSFilestreamFile, filename = 'C:\Blobstore') to filegroup RBSFilestreamProvider

Note: All the three queries replace [WSS_Content] with the content database name, and replace c:\BlobStore with the volume\directory in which you want the BLOB store created. See in fig

remote blob storage sharepoint 2016
remote blob storage SharePoint 2016

C) Install the RBS provider components on each server (SQL and Web Server)

To install RBS on SQL server and then First Web server follow the below steps

Browse to http://www.microsoft.com/download/en/details.aspx?id=16978 find rbs.msi download X64 Package.

Note: Do not download the rbs_x64 link given in TechNet article http://technet.microsoft.com/en-us/library/ee663474.aspx

Run cmd prompt as Administrator and then click OK. Change the directory to the place where rbs.msi is downloaded on the machine.

Copy and paste the following command into the Command Prompt window.

msiexec /qn /lvx* rbs_install_log.txt /i RBS.msi TRUSTSERVERCERTIFICATE=true FILEGROUP=PRIMARY DBNAME="WSS_Content" DBINSTANCE="DBInstance Name" FILESTREAMFILEGROUP=RBSFilestreamProvider FILESTREAMSTORENAME=FilestreamProvider_1

Note: Replace WSS_Content and DBInstance Name in the above command as your database content and database instance name.

After that, you can check for successful rbs installation than go that file The rbs_install_log.txt log file is created in the same location as the RBS_x64.msi file. Open the rbs_install_log.txt log file by using a text editor and scroll toward the bottom of the file. Within the last 20 lines of the end of the file, an entry should read as follows: Product: SQL Remote Blob Storage – Installation completed successfully. See in fig

remote blob storage sharepoint 2013 step by step

D) To enable RBS by using Windows PowerShell

On the Start menu, click All Programs. Click Microsoft SharePoint 2010 Products. Click SharePoint 2010 Management Shell. At the Windows PowerShell command prompt, type the following command:

$cdb = Get-SPContentDatabase < WSS_Content >
$rbss = $cdb.RemoteBlobStorageSettings
$rbss.Installed()
$rbss.Enable()
$rbss.SetActiveProviderName($rbss.GetProviderNames()[0])
$rbss

Note: Replace WSS_Content with your Database.

E) Test the configuration of RBS on the SharePoint 2010:

Now browse to the SharePoint website, which is configured to use RBS. Navigate to any document library and upload files over 100KB.
Now check the BLOB store folder size to see, if new files are copied. See in fig

Blob Cache in SharePoint

This is how we can configure remote blob storage in SharePoint.

You may also like following SharePoint tutorials:

This SharePoint tutorial, we learned:

  • What is Blob Cache in SharePoint
  • How to enable BLOB CACHE to use in Image Radiation in SharePoint 2013
  • How to configure remote blob storage in SharePoint
Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

>