BITS PEER CACHING

BITS Peer Caching – many clients only one Windows Update download – WSUS optimization

Posted on February 1, 2009 |

Source: Upwards in Small Business – SBSisyphus

Inside the WSUS 3.0 SP2 Operations Guide document in Appendix E (p123) I found this very cool nugget.  This applies to WSUS deployments where updates are not downloaded, stored, and distributed locally.

Assuming all the clients are online and scheduled to query and sync for Windows Updates (WSUS, WU, MU) together you could greatly benefit from only downloading a patch once.  For my peers in Australia who pay for bandwidth used this may be quite valuable.

Peer caching

Peer caching is a new feature of BITS 3.0 that allows peers (computers within the same subnet of a network that have the peer caching feature enabled) to share files. If peer caching is enabled on a computer, the Automatic Update agent instructs BITS to make downloaded files available to that computer’s peers as well.

When the files have been downloaded, BITS caches them. When another (peer caching-enabled) computer tries to download the same update, BITS on that computer sends a multicast request to all of that computer’s peers. If one or more of the peers responds to the request, BITS will download the file from the first computer to respond. If the download from the peer fails or take too long, BITS continues the download from the WSUS server or Microsoft Update.

This feature of BITS can optimize the bandwidth used by WSUS in several ways.

  1. Peer caching decreases the amount of data transferred from the WSUS server to its clients, because computers in the same subnet will usually download the updates from each other.
  2. Peer caching decreases the amount of data transferred across the WAN when some or all of the clients of a WSUS server are located in different locations.
  3. Peer caching decreases the amount of data transferred across the Internet if WSUS clients in the same subnet are configured to download updates from Microsoft Update.

Note

BITS peer caching requires computers to be running Windows Vista or Windows Server 2008, and to be part of an Active Directory Domain.

For more information about peer caching and peer servers, see Peer Caching(http://go.microsoft.com/fwlink/?LinkId=79432).

To enable peer caching (on Windows Vista)

  1. Start the Group Policy Object Editor (click Start, click Run, and then type gpedit.msc).
  2. Expand Computer Configuration, then Administrative Templates, then Network, then Background Intelligent Transfer Service.
  3. Enable the Allow BITS Peercaching setting.
  4. Enable the Maximum network bandwidth used for Peercaching setting, and set the maximum bandwidth in bits per second (the default is 104857), then click OK.
  5. Enable the Limit the BITS Peercache size setting, and set the percentage of disk space to be used for the peer cache (the default is 5 percent), and then click OK.
  6. Enable the Limit age of items in the BITs Peercache setting, and set the number of days (the default is 90), and then click OK.

Note

You must be an administrator to perform this procedure.

**author note**  besides modifying the applicable GPO on Vista you could also do this from a Server 2008 server.  Vista is the first client OS to provide domain scope GPO management

Source: Limit the maximum network bandwidth for
BITS background transfersscription:  Computer step by step
 Make your Pc better


This policy setting limits the network bandwidth that Background Intelligent Transfer Service (BITS) uses for
background transfers. (This policy setting does not affect foreground transfers.)

       You can specify a limit to use during a specific time interval and at all other times. For example, limit the
use of network bandwidth to 10 Kbps from 8:00 A.M. to 5:00 P.M., and use all available unused bandwidth
the rest of the day’s hours.

       If you enable this policy setting, BITS will limit its bandwidth usage to the specified values. You can
specify the limit in kilobits per second (Kbps). If you specify a value less than 2 kilobits, BITS will continue to
use approximately 2 kilobits.
To prevent BITS transfers from occurring, specify a limit of 0.

       If you disable or do not configure this policy setting, BITS uses all available unused bandwidth.

       Note: You should base the limit on the speed of the network link, not the computer’s network interface
card (NIC). This policy setting does not affect Peercaching transfers between peer computers (it does affect
transfers from the origin server); the “Limit the maximum network bandwidth used for Peercaching” policy
setting should be used for that purpose.

       Consider using this setting to prevent BITS transfers from competing for network bandwidth when the
client has a fast network card (10Mbs), but is connected to the network via a slow link (56Kbs)

Supported on: Windows XP SP2 or Windows Server 2003 SP1, or computers with BITS 2.0 installed.
Limit the maximum network bandwidth for
BITS background transfers

DescriptionGpeditRegeditCMDBack

VBScriptPowerShell Script

Gpedit:

Please perform the following steps:

Please go to Pearl button (Start) and click on the Search programs and files
For more information about the change from Start to Pearl button click here

Type gpedit.msc and press Enter

In the Group Policy window please navigate to Computer Configuration -> Administrative Templates ->
Network -> Background Intelligent Transfer Service (BITS) and open Limit the maximum network
bandwidth for BITS background transfers
.
Not Configured -> is the Default state
Enabled -> apply this GPO
Disabled -> this GPO will not be applied

To finish press ok button and close Group Policy window.

DescriptionGpeditRegeditCMDUpBack

VBScript

Type regedit and press ok

Please confirm User Account Control pop-up

Microsoft official disclaimer

Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by
using another method. These problems might require that you reinstall the operating system. Microsoft
cannot guarantee that these problems can be solved. Modify the registry at your own risk.

Note: This registry key is created by Group Policy when this GPO is Enable. The GPO Default state is Not
Configured -> this registry entry is not present. For Disable this registry entry is not present.

Please navigate to HKEY_LOCAL_MACHINESOFTWAREPoliciesMicrosoftWindowsBITS and locate
EnableBITSMaxBandwidth registry key
MaxBandwidthValidFrom registry key
MaxBandwidthValidTo registry key
MaxTransferRateOffSchedule registry key
MaxTransferRateOnSchedule registry key
UseSystemMaximum registry key
Regedit:          

Please perform the following steps:

Please go to Pearl button (Start) and click on the Search programs and files
For more information about the change from Start to Pearl button click here

DescriptionGpeditRegeditCMDUpBack

VBScriptPowerShell ScriptPowerShell Script

   
   
Double click on EnableBITSMaxBandwidth and edit the value:

To Enable:
Change the data value with:

EnableBITSMaxBandwidth = 1
MaxBandwidthValidFrom = 8
MaxBandwidthValidTo = 11
MaxTransferRateOffSchedule = 14
MaxTransferRateOnSchedule = a
UseSystemMaximum = 1

To finish press ok button and close Registry Editor window

Note: Manual editing of this registry key will not be reflected in Group Policy. If you modify this GPO from
Group Policy this registry key will be rewritten.

DescriptionGpeditRegeditBackCMD

VBScriptUp

Type cmd, right click on cmd icon under the Programs and click on Run as administrator

Please confirm User Account Control pop-up

Please select, right and copy a registry key from below, then right click on command prompt window
, select Paste and press Enter

Enabled:
REG add “HKLMSOFTWAREPoliciesMicrosoftWindowsBITS” /v EnableBITSMaxBandwidth /t REG_DWORD /d 1 /f
REG add “HKLMSOFTWAREPoliciesMicrosoftWindowsBITS” /v MaxBandwidthValidFrom /t REG_DWORD /d 8 /f
REG add “HKLMSOFTWAREPoliciesMicrosoftWindowsBITS” /v MaxBandwidthValidTo /t REG_DWORD /d 17 /f
REG add “HKLMSOFTWAREPoliciesMicrosoftWindowsBITS” /v MaxTransferRateOffSchedule /t REG_DWORD /d 20 /f
REG add “HKLMSOFTWAREPoliciesMicrosoftWindowsBITS” /v MaxTransferRateOnSchedule /t REG_DWORD /d 10 /f
REG add “HKLMSOFTWAREPoliciesMicrosoftWindowsBITS” /v UseSystemMaximum /t REG_DWORD /d 1 /f

Not ConfiguredDisabled:
REG DELETE “HKLMSOFTWAREPoliciesMicrosoftWindowsBITS” /v EnableBITSMaxBandwidth /f
REG DELETE “HKLMSOFTWAREPoliciesMicrosoftWindowsBITS” /v MaxBandwidthValidFrom /f
REG DELETE “HKLMSOFTWAREPoliciesMicrosoftWindowsBITS” /v MaxBandwidthValidTo /f
REG DELETE “HKLMSOFTWAREPoliciesMicrosoftWindowsBITS” /v MaxTransferRateOffSchedule /f
REG DELETE “HKLMSOFTWAREPoliciesMicrosoftWindowsBITS” /v MaxTransferRateOnSchedule /f
REG DELETE “HKLMSOFTWAREPoliciesMicrosoftWindowsBITS” /v UseSystemMaximum /f

Note: Manual editing of this registry key will not be reflected in Group Policy. If you modify this GPO from
Group Policy this registry key will be rewritten.
CMD:

Please perform the following steps:

Please go to Pearl button (Start) and click on the Search programs and files
For more information about the change from Start to Pearl button click here

PowerShell Script

   

DescriptionGpeditRegeditBackCMD

VBScriptUp

VBScript:

Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = “.”
Set oReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\” & _
strComputer & “rootdefault:StdRegProv”)

strKeyPath = “SOFTWAREPoliciesMicrosoftWindowsBITS”
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
strValueName1 = “EnableBITSMaxBandwidth
strValueName2 = “MaxBandwidthValidFrom
strValueName3 = “MaxBandwidthValidTo
strValueName4 = “MaxTransferRateOffSchedule
strValueName5 = “MaxTransferRateOnSchedule
strValueName6 = “UseSystemMaximum
‘Enabled
dwValue1 = 1
dwValue2 = 8
dwValue3 = 17
dwValue4 = 20
dwValue5 = 10
dwValue6 = 1
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName1,dwValue1
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName2,dwValue2
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName3,dwValue3
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName4,dwValue4
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName5,dwValue5
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName6,dwValue6
‘Not Configured/Disabled
‘oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName1
‘oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName2
‘oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName3
‘oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName4
‘oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName5
‘oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName6

PowerShell Script

   

DescriptionGpeditRegeditBackCMD

VBScriptUp

PowerShell Script :

Enabled

$RegKey = “HKLM:SOFTWAREPoliciesMicrosoftWindows”
If(Test-Path ($RegKey + “BITS”))
{
  $RegKey = “HKLM:SOFTWAREPoliciesMicrosoftWindowsBITS”
  ##Enabled
  New-ItemProperty -path $RegKey -name EnableBITSMaxBandwidth -value 1 -PropertyType DWord -Force
  New-ItemProperty -path $RegKey -name MaxBandwidthValidFrom -value 8 -PropertyType DWord -Force
  New-ItemProperty -path $RegKey -name MaxBandwidthValidTo -value 17 -PropertyType DWord -Force
  New-ItemProperty -path $RegKey -name MaxTransferRateOffSchedule -value 20 -PropertyType DWord -Force
  New-ItemProperty -path $RegKey -name MaxTransferRateOnSchedule -value 10 -PropertyType DWord -Force
  New-ItemProperty -path $RegKey -name UseSystemMaximum -value 1 -PropertyType DWord -Force
}
else
{
  New-Item -path $RegKey -name BITS
  $RegKey = “HKLM:SOFTWAREPoliciesMicrosoftWindowsBITS”
  ##Enabled
  New-ItemProperty -path $RegKey -name EnableBITSMaxBandwidth -value 1 -PropertyType DWord
  New-ItemProperty -path $RegKey -name MaxBandwidthValidFrom -value 8 -PropertyType DWord
  New-ItemProperty -path $RegKey -name MaxBandwidthValidTo -value 17 -PropertyType DWord
  New-ItemProperty -path $RegKey -name MaxTransferRateOffSchedule -value 20 -PropertyType DWord
  New-ItemProperty -path $RegKey -name MaxTransferRateOnSchedule -value 10 -PropertyType DWord
  New-ItemProperty -path $RegKey -name UseSystemMaximum -value 1 -PropertyType DWord
}

Not ConfiguredDisabled

$RegKey = “HKLM:SOFTWAREPoliciesMicrosoftWindows”
Remove-ItemProperty -Path($RegKey + “BITS”) -name EnableBITSMaxBandwidth
Remove-ItemProperty -Path($RegKey + “BITS”) -name MaxBandwidthValidFrom
Remove-ItemProperty -Path($RegKey + “BITS”) -name MaxBandwidthValidTo
Remove-ItemProperty -Path($RegKey + “BITS”) -name MaxTransferRateOffSchedule
Remove-ItemProperty -Path($RegKey + “BITS”) -name MaxTransferRateOnSchedule
Remove-ItemProperty -Path($RegKey + “BITS”) -name UseSystemMaximum
If( (Get-Item -Path($RegKey + “BITS”)).ValueCount -eq 0 -and (Get-Item -Path($RegKey + “BITS”)).SubKeyCount -eq 0)
{
  Remove-Item -Path($RegKey + “BITS”)
}