Wednesday, September 19, 2012

Tips utilizing SharePoint 2010 BLOB cache to improve performance

SharePoint Server 2010 provides a disk-based cache (BLOB cache) that stores files that are used by Web pages to help them load quickly in the browser, and reduces the load on the database server when it uses those files. The BLOB cache is stored directly on the hard disk drive of a front-end Web server computer to reduce the load on the SharePoint Server 2010 database server created by read requests from Web browsers. As a result, the performance will be improved to access cached content.

When enabled, the BLOB cache caches various image, audio, and video files, together with .css and .js files. Before you enable the BLOB cache, carefully consider the scenario in which you plan to use it. In this blog, we will cover some of the tips that might help you to utilize the BLOB cache to improve performance. 

1. How to reduce the performance hit for the first time access?
After BLOB cache enabled, the first time that a Web page is called, these files are copied from the database to the cache on the server hard disk drive, and all subsequent requests for those files are then served from the hard disk drive cache of the server. As a result, there is an additional time SharePoint spend to build the cache on IIS server hard disk drive. In order to minimize the performance hit, we would recommend running the SharePoint warm-up script on ALL IIS servers to build all site caches before uses access them.

2. How to avoid cache out of sync?
After BLOB cache enabled, SharePoint files are copied from the database to the cache on the server hard disk drive. If the cache on the server hard disk drive deleted, hard drive crashed, or content database restored or imported, the BLOB cache becomes out of sync with the content. We recommend flushing the BLOB on ALL IIS servers. You could use the powershell flush script to rebuild cache.

3. How to maximize the performance?
If your site will be used for heavy collaboration, enabling the BLOB cache might temporarily affect the performance of your site while the files to be cached are first written to the disk. As a result, do not cache collaboration file type such as .docx. Since the sites with publishing feature enabled are using “Site Assets” and “Style Library”, you should identify additional file type to be cache. One example is to include additional file type like .htc files for publish sites

4. How to reduce server performance impact caused by I/O operation?
If you plan to use the BLOB cache in a scenario with heavy cache use, such as serving videos in a high traffic environment, and if you will use ULS logging, consider placing the BLOB cache on a separate physical drive from the ULS log — not on a separate partition. Storing the BLOB cache and the ULS log on the same drive can result in poor server performance. If you place the BLOB cache and the ULS log on the same physical drive, make sure that you closely monitor the disk queue length for any performance effect.

5. How to avoid HTTP 304 error after BLOB enabled?
You might be aware of the HTTP 304 error when you use F5/Refresh for SharePoint 2010. The way to resolve this is to setup the cache max age in web.config files. You could set the value based your business requirement. In our case, we have three week Sprint release and would recommend setting up to 1814400 that is three weeks.

6. How to avoild security hole on unique item level permissions?
Some users identified a security hole when you have item level permissions on sites with anonymous access enabled. Even you have unique permission applied to the item; BLOB cache does not apply the correct permission and it will still open to anonymous access. This seems to be fixed in August 2012 CU. If you have enabled anonymous access and have unique item level permissions, you might need to apply August 2012 CU.
There are some other considerations you might need to take a look before you enable the BLOB cache. You might also need to explore to enable other caches like “Page output cache” and “Object cache” to future improve the performance. You should use some testing tools like Fiddler to Cache-Control value change to public and max-age for different type of caches like “Site Assets” and “Style Library”.

If you want to automate the BLOB cache web.config file changes, you could refer this blog by using powershell. I've modified to future enhance the performance you could refer in different blog.


1 comment: