Saturday, June 8, 2013

Best practices for Blob cache

Blob cache is to reduce traffic in b/w sql server and front ends. So a copy of frequently accessed files is kept on each WFE. Enabling blob cache also passes information in http headers to client browser to fetch the data from cache rather than round trips.

This needs publishing framework. You might have to increase RAM on each front end on average by 800 bytes per file. Also, server relative urls should be less than 160 characters to be blob cached (with a path in file system as less than 260 characters)





But sometimes large blob cache will reduce your performance rather helping with heavy loads. Blob cache index are written to hard drive periodically and before recycle. When this serialization is progress, it will affect the time taken to serve the client request.

It is even more devastating when app pool recycle corrupt indexes and files are no longer being fetched from blob cache ; this happens generally because - if timeout for recycle is lower than time taken to save the indexes on disk





Best practices for Blob cache:



1. Try to keep the content stable for live environments and blob cache should be planned for content with lesser changes, when blob is invalidated by Framework?

2. Better to add mime types for files being blob cached.  Alternate in webconfig [ BlobCache node] use parameter browserFileHandling = "nosniff"  [ possible values nosniff|strict ]

3. The content in blobcache folder should be managed by framework. Let it be created and managed by SharePoint.

4. Server relative urls should be less than 160 characters to be blob cached ( with a path in file system as less than 260 characters)

5. How to flush blob cache ?

6. For large blob cache increase parameter WriteIndexInterval in webconfig [ BlobCache node]. Default is 60 . You might want to serialize it may after 1 hour [ 86400] for very large blob cache. { this setting is not recommended for small blob cache size }

7. Recommended time limits to shut down and start up web application is 300 seconds. Default is 90 seconds. For large blob cache you might even go up to 600 seconds.

8. Plan for sufficient disk space as per size of content.

You may also like:

Include specific folder content in BlobCache SharePoint


when blob cache must be invalidated by framework ?


System.UnauthorizedAccessException to BlobCache Folder


Getting multiple hits to files after enabling BLOB cache


One thought on “Best practices for Blob cache

I am getting below mentioned error in Microsoft.SharePoint.Publishing.BlobCache.CreateFile(String tempFileName, SPFile file, BlobCacheEntry target, Int32 chunkSize) :
Process : w3wp.exe (_x-_-_)
Thread ID : _x-_-_
Area : SharePoint Foundation
Category : Performance
Event ID : n-_-
Level : Monitorable
Message :
An SPRequest object was reclaimed by the garbage collector instead of being explicitly freed. To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it. Allocation Id: {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx} This SPRequest was allocated at at Microsoft.SharePoint.Library.SPRequest..ctor() at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(SPSite site, String name, Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous) at Microsoft.SharePoint.SPWeb.InitializeSPRequest() at Microsoft.SharePoint.SPListCollection.EnsureListsData(Guid webId, String strListName) at Microsoft.SharePoint.SPListCollection.ItemByInternalName(String strInternalName, Boolean bThrowException) at Microsoft.SharePoint.SPItemEventProperties.get_List() at Microsoft.SharePoint.Taxonomy.TaxonomyItemEventReceiver.ItemUpdating(SPItemEventProperties properties) at Microsoft.SharePoint.SPEventManager.RunItemEventReceiver(SPItemEventReceiver receiver, SPUserCodeInfo userCodeInfo, SPItemEventProperties properties, SPEventContext context, String receiverData) at Microsoft.SharePoint.SPEventManager.RunItemEventReceiverHelper(Object receiver, SPUserCodeInfo userCodeInfo, Object properties, SPEventContext context, String receiverData) at Microsoft.SharePoint.SPEventManager.c__DisplayClassc`1.b__6() at Microsoft.SharePoint.SPSecurity.RunAsUser(SPUserToken userToken, Boolean bResetContext, WaitCallback code, Object param) at Microsoft.SharePoint.SPEventManager.InvokeEventReceivers[ReceiverType](SPUserToken userToken, Guid tranLockerId, RunEventReceiver runEventReceiver, Object receivers, Object properties, Boolean checkCancel) at Microsoft.SharePoint.SPEventManager.InvokeEventReceivers[ReceiverType](Byte[] userTokenBytes, Guid tranLockerId, RunEventReceiver runEventReceiver, Object receivers, Object properties, Boolean checkCancel) at Microsoft.SharePoint.SPEventManager.ExecuteItemEventReceivers(Byte[]& userToken, Guid& tranLockerId, Object& receivers, ItemEventReceiverParams& itemEventParams, Object& changedFields, EventReceiverResult& eventResult, String& errorMessage) at Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileAsStream(String bstrUrl, String bstrWebRelativeUrl, Boolean bHonorLevel, Byte iLevel, OpenBinaryFlags grfob, String bstrEtagNotMatch, String& pEtagNew, String& pContentTagNew) at Microsoft.SharePoint.Library.SPRequest.GetFileAsStream(String bstrUrl, String bstrWebRelativeUrl, Boolean bHonorLevel, Byte iLevel, OpenBinaryFlags grfob, String bstrEtagNotMatch, String& pEtagNew, String& pContentTagNew) at Microsoft.SharePoint.SPFile.GetFileStreamCore(OpenBinaryFlags openOptions, String etagNotMatch, String& etagNew, String& contentTagNew) at Microsoft.SharePoint.SPFile.GetFileStream(OpenBinaryFlags openOptions, String etagNotMatch, String& etagNew, String& contentTagNew) at Microsoft.SharePoint.SPFile.OpenBinaryStream() at Microsoft.SharePoint.Publishing.BlobCache.CreateFile(String tempFileName, SPFile file, BlobCacheEntry target, Int32 chunkSize) at Microsoft.SharePoint.Publishing.BlobCache.c__DisplayClass34.c__DisplayClass37.b__31() at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock) at Microsoft.Office.Server.Diagnostics.ULS.SendWatsonOnExceptionTag(UInt32 tagID, ULSCatBase categoryID, String output, Boolean fRethrowException, TryBlock tryBlock, CatchBlock catchBlock, FinallyBlock finallyBlock) at Microsoft.SharePoint.Publishing.BlobCache.c__DisplayClass34.b__30() at Microsoft.SharePoint.SPSecurity.c__DisplayClass4.b__2() at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) at Microsoft.SharePoint.Publishing.BlobCache.FetchItemFromWss(Uri path, Boolean isHostNamedSite) at Microsoft.SharePoint.Publishing.BlobCache.RewriteUrl(Object sender, EventArgs e, Boolean preAuthenticate) at Microsoft.SharePoint.Publishing.PublishingHttpModule.AuthorizeRequestHandler(Object sender, EventArgs ea) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error) at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb) at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
Please share your thought on this .


No comments:

Post a Comment