Technet Distributed Cache Articles are updated !

Heads up , Technet Distributed Cache Articles are updated !

Plan for feeds and the Distributed Cache service in SharePoint Server 2013
https://technet.microsoft.com/en-us/library/jj219572.aspx

Microsoft has updated the following sections:

• Capacity planning for the Distributed Cache service
• Memory allocation

The memory issues have been noted here. Now we are requiring at least 34GB of memory for 16Gb Cache Servers. If more than 16GB’s are required, we now require at least 2 cache servers

Manage the Distributed Cache service in SharePoint Server 2013
https://technet.microsoft.com/en-us/library/jj219613.aspx

Microsoft has updated the following section:

*Fine-tune the Distributed Cache service by using a Windows PowerShell script
*Changed the Graceful Shutdown procedure

In the “Fine-tune the Distributed Cache” section we called out the MaxConnectionsToServer issue and have a script to tune these settings. We are also tuning the “DistributedLogonTokenCache” and “DistributedViewStateCache” as the defaults are too small.

This should eventually eliminate many support cases that occur after customers follow bad advice from random Blogs and utilize default settings.

Keynotes for Distributed Cache on SharePoint 2013

My colleague Hector has created a very good article by compiling different issues with Distributed Cache.
You can read the orginal article below link:
http://blogs.msdn.com/b/calvarro/archive/2013/08/29/points-to-consider-with-distributed-cache-on-sharepoint-2013.aspx

Here is the key notes:

  • NEVER admin the distributed cache from the admin console
  • Maximum capacity of memory is 16 GB per host cache
  • Dynamic memory is not supported in SharePoint 2013 environments nor APP fabric servers
  • The prodcuct after being installed allocates 10% of the physical RAM memory available at the sever. It can be configured following the next point.
  • It’s recommended to allocate 2 GB for other services.
  • It’s not supported to develop code against the Distributed Cache of SharePoint 2013.
    “If you are using custom applications in SharePoint Server 2013 which use the AppFabric client APIs, or are creating custom caches, you should create a separate AppFabric cache cluster to support your custom applications. Do not use the AppFabric cache cluster supporting your SharePoint Server 2013 farm. Run your separate AppFabric cache cluster for your custom applications on separate servers from the servers dedicated to your SharePoint Server 2013 farm.
    http://blogs.msdn.com/b/calvarro/archive/2013/06/05/supportability-of-custom-developments-in-sps-2013-and-appfabric-cache.aspx
  • Install the latest APP Fabric CU if possible. Right now we are in CU 4

when CacheItemRemovedCallback is raised HttpContext.Current is null

CacheItemRemovedCallback shows users the value assigned to an item in the cache and then notifies them when the item is removed from the cache. It creates a RemovedCallback method, which uses the signature of the CacheItemRemovedCallback delegate, to notify users when the cache item is removed and uses theCacheItemRemovedReason enumeration to tell them why it was removed.But when you try to use cache with HttpContext.Current it encounter an object not set reference error.

Here is the solution.

Use :HttpRuntime.Cache instead of HttpContext.Current.Cache object

Example::

 public static void DropUser(string key, object value, CacheItemRemovedReason reason)
        {
            List<string> OnlineUserAccounts = null;
            if (HttpRuntime.Cache[CACHE_KEY] != null)
            {
                OnlineUserAccounts = (List<string>)HttpRuntime.Cache[CACHE_KEY];
                if (OnlineUserAccounts.Contains(key))
                {
                    OnlineUserAccounts.Remove(key);
 
                    HttpRuntime.Cache[CACHE_KEY] = OnlineUserAccounts;
                }
            }
        }
 
Happy Codding.