BLOB Cache


SharePoint Caching
Caching is used to improve the performance of any software and it reduces the load on backend supportive software. In SharePoint Caching reduces the overhead and dependency of SharePoint server from SQL server. When we use cache in SharePoint server it saves all data on WFE server's Ram and/or their physical drives and then show the future results from that saved data. This data is replica of the copy of original data. Whenever a data is changed in server it automatically changed in cache data also. There are total four type of Caching is available in SharePoint 2013.
Source -


BLOB CACHE

This is also known as disk-based cache. It stores files that are used by web pages to help them load quickly in the browser, and reduces the load on the SQL database server when it uses those files. The first time when a web page is called, all the files, images and videos are stored from the SQL database server to BLOB cache of the WFE sever that is responding the page request. This BLOB cache is available on a disk drive in the WFE server's hard disk drive. When ever the page is again requested from any user the data is rendered through the cache file instead of database. So that the request does not go to database server.
These files in cache are known as BLOBs (Binary Large Object) and the cache it self called as BLOB Cache. The same process is followed by each WFE server. Each WFE server contains its own BLOB cache on its local disk drive. By default, BLOB cache is disabled and must be enabled if you want to improve the performance of SharePoint server and want to reduce the load on the SharePoint Servers 2013 's SQL database server.
Usages -
1.      BLOB caching is much useful when resources such as JavaScript files, CSS and images are frequently accessed.
2.      It is also useful in case of rich media and videos, which are large files.
3.      It is useful for word, excel, pdf files as well.
Disadvantage -
1.      BLOB caching is not much useful when files are not frequently accessed or change a lot.
2.      If files changes a log, the chance that the file is still in the BLOB cache when subsequently requested is too low while getting it from the database and storing it in BLOB cache may cause a performance issue.

Configuring BLOB Cache
Blob cache is configured on web application level. So we have make changes on web application level and those changes will be applied to all site collections and site in the web application. BLOB cache can be enabled from web.config file of the web application. To enable blob cache perform these steps on all the WFE servers -
1.      Make sure that you are the local administrator on the local WFE server to configure the BLOB cache settings.
2.      Go to Start – Administrative Tools – Internet Information Services (IIS) Manager.
3.      In IIS Manager, Under Connections pane, Click on the + sign next to your server name and then click on + sign next to Sites to view the web applications.
4.      Right Click on the name of the web application where you want to enable blob cache and select Explore.
5.      Search for the file Web.config and Right Click on it and open this file in Notepad.
6.      In the file search for "<Blobcache" and the line should be something like as follows
<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" />
  1. In this line change the Location attribute with the location where you want to store the BLOB files. It is recommended by Microsoft that you specify a directory that is not on the same drive as where your OS is installed or server log files are stored or that is more accessible from other objects.
  2. You can add remove file extensions to be stored in blob cache by adding them or removing them from path attribute (provide file extensions separated by |).
  3. Change the site of the cache. The unit of this size in GB. It is recommended by Microsoft to use 10 GB for BLOB cache. So default is 10 you can change it depending on the files that will be stored in this cache.
  4. To enable the BLOB cache, change the enable attribute from False to true.
  5. Save the file and close it.

This process will reset the web application so make sure that you are will need downtime before saving web config file.

Flush the BLOB Cache -
Some times BLOB cache stop syncing with database. In that case we have to flush the BLOB Cache.

User must who is going to flush the BLOB cache must have securityadmin and dbowner rights on SQL and database. User should also be local administrator on the server where this script will be executed.

Click on this link to get the power shell script
https://drive.google.com/file/d/0BznVpoE_ln0AeXEzN2xmZzRCT0k/view?usp=sharing 

Other Cache options in SharePoint
  1. Page Output Cache
  2. Object Cache

No comments:

Post a Comment