BranchCache and SMB Integration is the topic of this post and we will see how BranchCache really works when a BranchCache capable client tries to access a remote file share on the main site.
So BranchCache is hocked in the Client Side Caching (CSC) component on SMB (same component that allows us to use offline files technology) and it is the integration point for BranchCache.
So what happened when a client makes a BranchCache SMB request?
The application makes a read file operation on a remote SMB server (Step 1) and that is intercepted by the CSC driver and then a request is made to the CSC service to go and pre-fetch the file that the app is looking for.
CSC service will then go and pre-fetch the hashes of the file instead of the complete file (Step 2 and 3). So cache download is going to happen over the SMB protocol. We are going to download hashes instead of data. The server will then will try to pull those hashes from a cache hash (Step 4).
Hashes come back to the client (Step 5), to the CSC service and then Peer distribution APIs are called so we can find the data on a peer client or on the Hosted Cache server. After the content is retrieved from a peer client or Hosted Cache Server, we will supply it back to the CSC driver, then to the APP and finally we will put it in the CSC cache (Step 6 and 7).
Subsequent access to the same file is served from the CSC cache and not the branch cache.
Now back to the point where “Hashes on the file server are stored on the Hash Cache”. There are different ways to fill it up. There is a service that will calculate hashes when the CPU utilization is low on the server and the second way is using a tool called HashGen that you can run against the share and it will force generation of those hashes.
The first time that a file is requested from a file share or web server, it has to generate hashes of the data as they are moving through the network stack. Generating hashes is not that big deal, but does take a little of time, so we don’t hold up a client requesting a file just to generate hashes. We will give him the data right away and we will calculate hashes as the data is moving through the network stack. So if you are going to play with BranchCache, remember that the third hit is when you will notice some improvement.
If you are interested to know more about this nice technology, come here again and filter posts with (BranchCache) tag.