Udostępnij za pośrednictwem


Configuring SCCM and Branch Cache

BranchCache is a feature introduced with Windows 2008 R2 that allows systems within the same subnet and separated from a content source (such as a WSUS server) to share downloaded content locally rather than each system having to traverse a latent network link back to the content source.  BranchCache has two modes of operation – distributed cache mode and hosted cache mode.  SCCM only supports distributed cache mode.

As mentioned, BranchCache is a function of the OS and not of SCCM but, with the release of SCCM SP2, we now are able to leverage BranchCache on enabled servers.  When we find BranchCache enabled we use it – there is no special SCCM configuration requirements for BranchCache other than what is likely in se in most environments anyway.  We will highlight those shortly but to start a diagram of a sample configuration might help explain how this is all setup.

image

In the diagram we have 4 systems.  The SCCM SP2 site server, an SCCM distribution point being hosted on a Windows 2008 R2 server that has BranchCache enabled and two client systems – one server and one workstation.  We have mentioned already that to support BranchCache we need to use a Windows 2008 R2 system – but what about clients?  From the diagram note that BranchCache is supported natively on Windows 2008 R2 and Windows 7 – and with the addition of BITS 4.0 clients can also take advantage of BranchCache on Vista SP1 and Windows 2008 SP1/SP2. 

The diagram shows how SCCM works with BranchCache.  The first time content is requested from the distribution point the client has no choice but to retrieve it across the latent network.  Once retrieved the content is stored by BranchCache.  When the second client attempts to retrieve the content it detects a latent network and sends out a request for any peers with the content.  The first client responds and serves up the content thus avoiding the need to pull it across from the distribution point.

OK, so we have the general concept of how it works – so how do we set it up?  It’s fairly easy.  First, what are the requirements in SCCM to make use of BranchCache.  We need our distribution point to be installed on Windows 2008 R2 and to be BITS enabled.

image

The only other requirement is that your advertisement be set to download and execute locally.

image

Both of these settings are common in most environments and are all that is required on the SCCM side.  There is no selection in SCCM to ‘enable’ BranchCache – with the settings above it just happens. 

So how do we configure BranchCache on the OS side?  Just a few settings to configure.  First we need to enable BranchCache – let’s start with the distribution point.  In Server Manager, select features and add the BranchCache feature.  There is no configuration here – the feature is either on or off.  Once installed you will see it in the feature list.

image

Next, we have to configure BranchCache on our clients.  This can be done through local policy on each system or – much easier – through domain policy.  On my domain controller I open the group policy management console.  In my lab I created an OU for just the systems I want to enable for BranchCache and I created a GPO to enable BranchCache.

image

 

 

 

Editing the properties of the GPO we have two places to configure.  First, is BranchCache policy.  Here we enable BranchCcache, set distributed cache mode, define the speed that we consider to be a latent network (default 80 ms) and configure the percentage of disk space to allocate to BranchCache activity.

image

image

 

image

image

image

Note that the one option we did not configure was to enable hosted cache mode.  Why?  Remember, SCCM only supports distributed cache mode so, for SCCM, there is no need to enabled hosted cache mode. 

A word about hosted cache mode.  The OS documentation that discusses BranchCache discusses both modes of operation and discuses steps to configure SMB file transfers through BranchCache.  Configuring BranchCache to support SMB requires some additional configuration on the content server – such as enabling a role service called ‘BranchCache for network files’ and configuring specific shares to support BranchCache using the ‘share and storage management tool’.  Since SCCM uses BranchCache via BITS there is no need to do this additional configuration to support SMB.

In addition to the above we must configure the windows firewall to allow BranchCache specific communication as follows:

image

image

Both the inbound and outbound firewall rules are accessible on the predefined list – so configuring them is as easy as selecting from the drop down menu when configuring a new rule.

image

OK, so all of this is configured – how do we know if it’s working?  To test, I setup a package and advertisement.  When testing it’s important to understand that once the package is downloaded and cached, you have to either modify the content or setup a new package because unless there is a change, clients will always pull the content from the cache after the first download due to the latent network conditions.

For the test, I start with a fresh package.  The client that will download the content first will have to go to the distribution point – nothing will come from the cache since no content has yet been downloaded.

image

With all of this I’m ready to start the download but to simulate a latent network in my lab I must first start a tool that will ‘inject’ latency into the network connection between the distribution point and my first client.  I’ll use a tool we have internally to introduce a 30 ms latency – I will maintain this latency throughout my testing.  Note that my policy settings above consider any network more latent than 20 ms to be slow.

image

 

 

With all of this configured, I start my advertisement which initiates a download of content.

image

At the end of the download I run the advertisement and then move on to my second machine.  This second machine is where we expect to see BranchCache in action.

I prepare to run the same advertisement on the second machine – note you can tell that this advertisement has never been run before on my system – which is important when testing BranchCache.

image

I’m about to hit run but how can I tell whether BranchCache actually fires up?  Performance monitor.  With performance monitor you can determine  whether content is being transferred from the local BranchCache or from a BranchCache partner vs. the network.  The chart below shows a chart of perfmon counters that you get from the BranchCache object.  The two most interesting are the Bytes from cache and Bytes from server.  If content is being retrieved from either a systems local BranchCache or a peer systems BranchCache, that counter will show activity.  In our test case and on the second system, no content for this advertisement has ever been downloaded before so we expect content to be retrieved from our peer client that is BranchCache enabled.

image

We initiate the advertisement as before and downloading begins. 

image

We allow the download to finish, complete the advertisement and then look back at our performance counter numbers to see what happened.

image

By looking at our counters we can see that we did pull the content from our peer caching partner – so BranchCache worked.

Another way we can tell that our package came over from BranchCache is by looking in the event log on the system as show below.  Look for event 60 and on the detail tab look for the peerProtocolFlags value.  If it is set to 1 then BranchCache was used to deliver the content.  Thanks to my colleague Frank for the tip!

image

BranchCache is just one more option available to administrators to help deliver content to clients efficiently and reduce load on the network.  It’s not difficult to setup and offers notable performance advantage – defiantly worth taking a look.

For specific documentation on BranchCache visit https://www.branchcache.com

Comments

  • Anonymous
    February 08, 2010
    This is a very nice documentation. Is there any specific log file we can check? How about the branch cache size?

  • Anonymous
    February 09, 2010
    Thanks I haven't noticed any specific log to look at yet - haven't looked that hard though!  :) I do see in datatransferservice.log that when pulling from branchcache that it flags a BITS download - but that is not something that just happens with branchcache. Branch cache size will be whateveris configured in policy - haven't found the actual file share that hosts cached files yet but would guess it's encrypted/hidden somehow.

  • Anonymous
    February 23, 2011
    @SteveRac.  By default the BranchCache cache is under C:WindowsServiceProfilesNetworkService AppDataLocalPeerDistRepub.  This content is indeed encrypted

  • Anonymous
    March 09, 2011
    Yep - I hzd found it and forgotten to update here - thanks for calling it out.

  • Anonymous
    March 16, 2011
    Is there a reason that Branch Cache would not work from a distribution point's SMB share if BITS were disabled in SCCM?

  • Anonymous
    January 26, 2012
    How do Task Sequences behave when this is configured?  The Task Sequence Advertisement settings look quite different than a Package's Advertisement Settings.

  • Anonymous
    January 27, 2013
    Hi there Steve. Wanted to post a quick query - is BranchCache supported on ThinPC

  • Anonymous
    July 23, 2014
    Hi Steve! Congrats for a great article! I have a question: is possible use the branch cache if we don't have any server Win2008R2 in site? In our case, we have a many sites without any servers, only Windows 7 workstations. And this clients use a large bandwith to download SCCM packages. Is possible configure a Windows 7 to store the packages in this remote sites?

  • Anonymous
    November 10, 2014
    Hi Steve, although a great starting point for going with BranchCahce there is an error in there:  Latency settings does not apply to HTTP BranchCache which BITS is, its only for SMB. Here are also some answers to the questions:

  1. There are logs for BC, but often to detailed to make any sense out of them. Better to do reporting on it.
  2. The size of the cache can be seen by the following command "netsh branchcache show status all" (Registry key)
  3. BranchCache would work for SMB, but ConfigMgr 2012 only downloads over HTTP.
  4. Task Sequences needs to be poked manually to the right values.
  5. BranchCache is supported on Thin PC ( Embedded)
  6. You dont need a server in each location, thats the whole point. For other FAQ items please review the 2pintsoftware.com/2psfaq //Andreas ps. Also check out our BranchCache for OSD pack, enabling BranchCache in WinPE: 2pintsoftware.com/.../branchcache-for-osd-toolkit
  • Anonymous
    November 13, 2014
    Hi Andreas, this blog post was written back in the 2007 days when some of the items you mention were not true!  The blog post also is accurate even for 2012.  You have some good discussions though so if you would like to augment this post on your own blog please feel free. Cheers, Steve.

  • Anonymous
    May 19, 2015
    May i know difference between adaptiva onesite and brachcache in SCCM Content management? which is best tool for real time. as per my observed adaptiva is peer to peer