locked
BranchCache content information management RRS feed

  • Question

  • A simple question with what I assume is an obvious answer, but I could not find this stated anywhere...

    How does BranchCache determine what content to delete when the disk space allotted for the cache is exceeded? Oldest first? Least-accessed first? Does it always delete whole files or is it possible to retain some segments of a file but not others? The only information that I could find is that it discards unused files after 28 days (by default).

    Where, if anywhere, is this information noted? I could not find any of this in the technical overview (which is out-of-date to begin with and doesn't seem very in-depth for a 'technical' document). https://technet.microsoft.com/library/hh831696#BKMK_11 is the most up-to-date guide I could find on the subject.

    Monday, April 25, 2016 9:17 PM

Answers

  • hi,

    firstly, depends on the client OS. Win7/8 the old rules apply - i.e 28 days by default, which can be changed via policy/netsh.exe/powershell(win8 only)

    Secondly - BranchCache deletes segments (doesn't care about files) based on the 'last-accessed' date, so yes, least-accessed gets deleted first. 

    Thirdly - with Windows 10 the cache dynamically shrinks when the local disk starts to fill up, so you can set a much larger cache size. Same rules apply - least-accessed segments will be discarded first.

    The only way to guarantee that a file will stay in the cache would be to have some scheduled task to poke it I guess so that the TTL would be renewed. So trigger a download of that file every x days.

    Latest docs are here - https://technet.microsoft.com/en-us/library/mt652270.aspx?f=255&MSPPError=-2147217396

    https://technet.microsoft.com/en-us/library/mt613461.aspx


    Phil Wilcock http://2pintsoftware.com @2pintsoftware

    Wednesday, April 27, 2016 8:43 AM
  • I agree, and BranchCache documentation is a bit fragmented to say the least.

    I asked the product devs :-)

    From the horses mouth:

    Once the primary client data cache (aka Primary Republication Cache) reaches its max size, each time new segments are added to the cache, enough old segments are evicted and discarded based on a LRU (Least Recently Used) algorithm.

    That happened in Win7 and Win8.x as well.

    In Windows 7 and Windows 8.x that “max size” is always the max configured size (typically a percent of the target disk size), regardless of how much free space is available on disk.

    In Windows 10 we use an “effective max size”, which is in turn a percentage of the max configured size.

    This percentage is 100% when the disk is not in low disk space conditions, it is less than 100% when the free space is below the low disk space threshold, and it gradually goes down to 0% as available free space on disk goes to zero.

    That logic only sets the effective target max size. The algorithm used to make room / shrink the cache is still the same LRU one, so least-recently-used segments get kicked out first.


    Phil Wilcock http://2pintsoftware.com @2pintsoftware

    Wednesday, April 27, 2016 3:01 PM

All replies

  • Hi,

    Is there a way to configure a cached file so that it never expires?
    No. By default, cached contents are not removed from the cache for at least 28 days, unless deletion is required to make room for new content in the cache. Each time cached content is accessed by another client in the branch office, this 28 day expiration time is reset – so if a file is accessed frequently, the file might remain in the cache indefinitely.

    In addition, for Windows Server 2012 and Windows 8, you can use the cmdlet Set-BCDataCacheEntryMaxAge to specify the maximum amount of time that data can remain in the cache. The expiration time for content that is already in the cache is not affected when you run this command; only content added after you run the command has the new expiration time. The maximum value for this setting is 4294967295 days (~ 11,767,034 years), however if a file is not accessed for a long time and the cache runs out of space, the file might be deleted from the cache to make room for new content. The following example sets the expiration time for 60 days:
    Set-BCDataCacheEntryMaxAge -TimeDays 60

    Quote from BranchCache Frequently Asked Questions:
    http://social.technet.microsoft.com/wiki/contents/articles/14309.branchcache-frequently-asked-questions.aspx

    Best Regards,
    Eve Wang

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Tuesday, April 26, 2016 5:57 AM
  • hi,

    firstly, depends on the client OS. Win7/8 the old rules apply - i.e 28 days by default, which can be changed via policy/netsh.exe/powershell(win8 only)

    Secondly - BranchCache deletes segments (doesn't care about files) based on the 'last-accessed' date, so yes, least-accessed gets deleted first. 

    Thirdly - with Windows 10 the cache dynamically shrinks when the local disk starts to fill up, so you can set a much larger cache size. Same rules apply - least-accessed segments will be discarded first.

    The only way to guarantee that a file will stay in the cache would be to have some scheduled task to poke it I guess so that the TTL would be renewed. So trigger a download of that file every x days.

    Latest docs are here - https://technet.microsoft.com/en-us/library/mt652270.aspx?f=255&MSPPError=-2147217396

    https://technet.microsoft.com/en-us/library/mt613461.aspx


    Phil Wilcock http://2pintsoftware.com @2pintsoftware

    Wednesday, April 27, 2016 8:43 AM
  • That's good to know the selection process, but it would be better to have something written down in an official source somewhere. How did you learn that it deletes oldest access dates first?
    Wednesday, April 27, 2016 2:47 PM
  • I agree, and BranchCache documentation is a bit fragmented to say the least.

    I asked the product devs :-)

    From the horses mouth:

    Once the primary client data cache (aka Primary Republication Cache) reaches its max size, each time new segments are added to the cache, enough old segments are evicted and discarded based on a LRU (Least Recently Used) algorithm.

    That happened in Win7 and Win8.x as well.

    In Windows 7 and Windows 8.x that “max size” is always the max configured size (typically a percent of the target disk size), regardless of how much free space is available on disk.

    In Windows 10 we use an “effective max size”, which is in turn a percentage of the max configured size.

    This percentage is 100% when the disk is not in low disk space conditions, it is less than 100% when the free space is below the low disk space threshold, and it gradually goes down to 0% as available free space on disk goes to zero.

    That logic only sets the effective target max size. The algorithm used to make room / shrink the cache is still the same LRU one, so least-recently-used segments get kicked out first.


    Phil Wilcock http://2pintsoftware.com @2pintsoftware

    Wednesday, April 27, 2016 3:01 PM