Using Binary Delta Compression (BDC) Technology to Update Windows XP and Windows Server 2003 Microsoft Corporation Published: June 2005 Author: Susan Potter Editor: Bonnie Birger Abstract This document describes Binary Delta Compression (BDC) technology and its use in deploying software updates for Microsoft® Windows® XP and Windows Server™ 2003 operating systems. BDC is a differential compression technology that reduces the download size of software update packages. Express Installation updates that use BDC technology also make use of Background Intelligent Transfer Service (BITS), a file transfer technology that efficiently transfers files using idle network bandwidth. The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. This white paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT. Information in this document, including URL and other Internet Web site references, is subject to change without notice. The entire risk of the use or the results from the use of this document remains with the user. Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. © 2005 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows XP, Windows Server 2003 and Windows NT are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. The names of actual companies and products mentioned herein may be the trademarks of their respective owners. Contents Binary Delta Compression (BDC) Technology ................................................................... 5 Introduction to Binary Delta Compression ....................................................................... 5 Windows Update and BITS Technology Support ............................................................ 6 Express Installation Overview ......................................................................................... 7 Network Connectivity During Installation ......................................................................... 9 Compression Ratios for BDC ........................................................................................ 10 How Binary Delta Compression Works ......................................................................... 10 Selecting a Delta File to Download ................................................................................ 12 Self-Contained Installation vs. Express Installation ....................................................... 13 Summary ....................................................................................................................... 15 BDC 5 Binary Delta Compression (BDC) Technology This document describes how Binary Delta Compression (BDC) technology helps reduce the download size of software update packages for Microsoft® Windows® XP and Microsoft® Windows Server™ 2003 operating systems. Express Installation packages use BDC for downloading only the differences between old files and new files, resulting in smaller software update packages that require less time and network bandwidth to deploy. Files downloaded from versions of Microsoft Windows Update later than version 4.0 also support the use of the Background Intelligent Transfer Service (BITS), which efficiently transfers update files, preserves the responsiveness of other network applications, and automatically resumes file transfers after restarts or network disconnects. In addition, update installations that use the latest version of the Microsoft Software Update Services (SUS) client no longer require Microsoft Internet Information Services (IIS) server but can download updates from any server that supports HTTP 1.1, thereby reducing server traffic. Together, BDC and BITS can help streamline the process for downloading critical and security updates. (For information about updating Microsoft® Windows® 2000 using BDC, see Binary Delta Compression at http://go.microsoft.com/fwlink/?LinkId=44102.) Introduction to Binary Delta Compression Binary Delta Compression (BDC) is a differential compression technology that helps reduce the total download size of software update packages for Microsoft Express Installations, while ensuring that there is no loss of original data during the compression and transfer process. This technology reduces the download size of software updates by tailoring the download for each target computer, while producing exactly the same installation results as conventional update packages. Express Installation packages require less network bandwidth and help to reduce deployment costs. Conventional “self-contained” update packages — which contain all of the new files in compressed form — range from 500 kilobytes (KB) to several megabytes (MB), while service packs can be 100 MB or more. This makes download size significant when bandwidth is an issue. Conventional data compression techniques use a compressor that accepts one file as input and produces a single compact version of that file as output. A decompressor performs the inverse function, accepting the compact form as input and reconstructing the original file for output on the target computer. Express Installation BDC 6 packages that use BDC not only compress the required files but also reduce the size of the download by downloading only the differences (deltas) between existing files on a target computer and the desired new files where possible. The desired new files are then synthesized from the existing files and the downloaded delta files. After the synthesized delta files are verified as correct, the installation proceeds in the same manner as for selfcontained update packages. Windows Update and BITS Technology Support Updates that use BITS technology can be downloaded from the latest versions of Windows Update at http://go.microsoft.com/fwlink/?LinkId=18539. When you are running Windows XP or Windows Server 2003 with Service Pack 1 (SP1) operating systems, you automatically access the latest version of Windows Update (or Automatic Updates), thereby making BITS technology available for your downloads. This includes downloads of critical and security updates, such as Service Pack 2 (SP2) for Windows XP. (Note that BITS technology is not currently available for downloads to Windows 2000.) In addition, when you update Windows XP or Windows Server 2003 operating systems from Windows Update for the first time, your download includes the latest Software Update Services (SUS) client. This version of the SUS client brings significant improvements to Express Installations, including: Downloads managed using BITS technology Files for Windows XP and Windows Server 2003 (with SP1 installed) downloaded from Automatic Updates and Windows Update are managed using BITS technology. BITS manages file transfers to preserve the responsiveness of other network applications, and automatically resumes a transfer if the network connection is disrupted or the computer is restarted. For more information about BITS, see Background Intelligent Transfer Service in Windows Server 2003 at http://go.microsoft.com/fwlink/?LinkId=41252. Increased availability of Packages Previously, the server for Express Installation package downloads could only be a customized Internet Information Services (IIS) server. Clients could download updates only from these customized Microsoft servers, which caused large volumes of traffic on a limited number of update servers. With the latest version of Windows Update, any server that supports HTTP 1.1 can host and cache Express Installation packages and the deltas for download, which substantially increases the availability of packages. BDC 7 The following table provides a summary of operating system compatibility with the latest versions of Windows Update, BDC, and BITS. Note that when you access Windows Update, the version of Windows Update that you connect to is determined by the operating system that you are running, and does not display to the user. Operating System Windows Supports BDC Supports BITS Update version Requires server running IIS for update download Windows 2000 4 Yes No Yes Windows XP 5 Yes Yes No Windows 4 Server 2003 without SP1 installed Yes No Yes Windows Server 2003 with SP1 installed Yes Yes No 5a Express Installation Overview Express Installation packages are used primarily for individual computers that have Internet connectivity during installation; self-contained packages are used primarily for corporate deployment and other scenarios where downloading over the Internet is not possible or not desired. Beginning in 2003, Microsoft extended Express Installation benefits to critical, security, and other Windows updates available from the Windows Update Web site at http://go.microsoft.com/fwlink/?LinkId=18539. The package installer (formerly called Update.exe) is used to install these software updates. The following diagram illustrates the Express Installation process. BDC 8 Figure 1: The Express Installation Process The steps for an Express installation using the SUS client (which is included in your first download from Windows Update 5.0) are as follows: 1. When updates become available to a target computer from Windows Update (version 5.0 or later), or through Automatic Updates, the SUS client on the computer uses BITS technology to download the Express Installation package (which includes only the installer files and installation instructions, but does not contain the new payload files to be installed). 2. The Express Installation package is expanded into a sandbox (a restricted environment) on the target computer. 3. Update.exe, which is one of the files contained inside the Express Installation package, conducts an inventory of the target computer to determine: a. Whether any of the files to be updated are available in an updated form in some location on the computer. b. Whether any older versions of the files to be updated are available on the computer. Such files can be updated by downloading only delta files to update the old files. This is explained in detail in the section "Selecting a Delta File to Download" later in this white paper. Note: For more information about the package installer for Windows, see The Package Installer (Formerly Called Update.exe) for Microsoft Windows BDC 9 Operating Systems and Windows Components at http://go.microsoft.com/fwlink/?LinkId=44441. 4. A request for files and delta files is submitted to the Windows Update Agent resident on the target computer. This request will be for delta files when older versions of the files being updated are available on the target computer. Otherwise, compressed versions of the entire updated file will be requested. 5. The SUS client downloads the files and delta files requested by Update.exe. BITS transfers files over unused bandwidth, and also maintains file transfers when a network disconnection occurs or a computer needs to be restarted. When the network connection is reestablished, BITS continues the download from where it left off. 6. The downloaded files are copied into the sandbox. Deltas are applied to old versions of the respective files to synthesize the most updated version. 7. The SUS client then invokes Update.exe to validate the downloaded delta files and to generate new files. Update.exe verifies the integrity of the newly created files. If any new files unexpectedly fail this check, the self-contained package is downloaded and run instead. 8. Update.exe notifies the SUS client that all of the files required to install the update are present. 9. If Automatic Updates is configured to require confirmation, the SUS client prompts the computer administrator that an update is ready to install, and invokes Update.exe when the administrator chooses to accept installation. If Automatic Updates is set to install updates automatically, or if the SUS client performed the previous steps because the administrator chose to install the updates by using the Windows Update Web site, the installation continues automatically. Network Connectivity During Installation Unlike a self-contained package, an Express Installation package performs an additional download while it is running. In the past, Express Installations required a consistent network or Internet connection to the server hosting the updates while the installation ran. However, this requirement for network connectivity made Express Installations unsuitable when network or Internet connectivity to the server was not consistently available during update installation. Yet a previously downloaded self-contained package could be installed at a later time, even when a dial-up Internet connection was not available. But for installations that support BITS technology, it is now possible for installations to stop downloading when network connectivity is interrupted and then resume a download as BDC 10 network connectivity becomes available. This improvement allows updates to be deployed in a more timely fashion on installations that support BITS technology, when using either Automatic Updates or Windows Update. Compression Ratios for BDC The size of files downloaded using BDC is dependant on the total amount of data required to bring a file up-to-date. When delta files can be used, the total size of the download can be significantly reduced. While a compression ratio for conventional compression of executable files might be around 3:1, the compression ratio for BDC can be from 10:1 to 1,000:1 or higher, depending on the size of the original file and the number of differences between the original files and the new files. For example, if the code change is to fix a single buffer overrun, the delta file might be as small as a few hundred bytes. Using Express Installation with BDC, a service pack download is considerably smaller than the equivalent self-contained package. This makes it much more convenient to download service packs over low-bandwidth Internet connections. For example, the Microsoft® Windows® 2000 Service Pack 4 self-contained package is 135 MB, which would be impractical to download over a dial-up modem. However, the Express Installation package for this service pack typically downloads only 15 MB for a computer running Windows 2000 Server with Service Pack 3 installed. For computers that do not have the latest service pack installed, there will be a bigger difference in file size between the currently installed files and the required files, resulting in larger downloads. How Binary Delta Compression Works Binary Delta Compression is a technique for compressing files that differs somewhat from conventional compression. Conventional data compression techniques for file delivery use a compressor that accepts one file as input and produces a single compact version of that file as output. A decompressor performs the inverse function, accepting the compact form as input and reconstructing the original file for output on the target computer. This process is summarized in the following diagram. BDC 11 Figure 2: Conventional File Compression and Decompression In contrast, for each file to be delivered, BDC takes two files as input: the new file for delivery (Fnew) and an old file (Fold) from the target computer, which is usually an older version of the new file. The BDC compressor (Binary Delta Compression Creator) determines the differences between the old file and the new file and creates a compact delta file (∆F) as output. On the target computer, the BDC decompressor (Binary Delta Compression Applicator) takes the existing old file as a reference and the compact delta file as input and creates the new file as output. If the old file and the new file are very similar, the size of the delta file will be very small, generally much smaller than the file that results from simply compressing the new file conventionally. The size of the delta file is proportional to the number of differences between the old file and the new file. Binary Delta Compression Creator ( Fold , Fnew )→∆F Binary Delta Compression Applicator ( Fold , ∆F )→Fnew If the old file is known to exist on the target computer, only the compact delta file needs to be transmitted to the target computer to construct the new file. The Binary Delta Compression process is illustrated in the following Input/Output diagram. BDC 12 Figure 3: Binary Delta Compression and Decompression Selecting a Delta File to Download BDC is effective in reducing the download size of software update packages because most software updates contain only small modifications relative to the files that already exist on the target computer. However, a target computer might have many different versions of a file at one time. Therefore, the package installer for Windows must select which file is most similar to the target file and will yield the smallest delta file. For BDC to be effective, the appropriate delta file must be selected for download based on which old files are available on the target computer. When Automatic Updates or Windows Update downloads an Express Installation package onto the target computer, the package initially contains only the installation files (including Update.exe) and instructions, but does not contain the new files to be installed. Update.exe takes an inventory of the available old files on the target computer and then requests the SUS client to selectively download the set of delta files necessary to produce the set of new files required for the installation. The set of delta files required is dependent on the configuration of the target computer, so different target computers might download different sets of delta files to produce the same set of new files for installation. When delta files are downloaded using BITS technology, the download is robust enough to persist across restarts and network disconnections. The sets of delta files for any given software update package are stored in a patch storage file (PSF) that is hosted on an HTTP 1.1 server. In addition to delta files based on BDC 13 any number of older, previously released versions of the new files, the PSF also contains compressed copies of the updated files. If a given target computer does not have an old file that matches any of the delta files contained in the PSF, a compressed copy of the updated file is downloaded instead of a delta file. This provides a seamless, fault-tolerant mechanism to ensure that all of the new files can be produced on the target computer regardless of its existing configuration. Because each PSF contains all of the compressed new files and many delta files for each new file, the patch storage files are often quite large. However, because each individual installation downloads only the required set of delta files necessary for that target computer, each installation will download only a small fraction of the entire contents of a PSF. The following scenario illustrates a typical express download and installation sequence using Update.exe to update the file Webcheck.dll to version 5.2. The functionality of Update.exe is described in detail in The Package Installer (Formerly Called Update.exe) for Microsoft Windows Operating Systems and Windows Components at http://go.microsoft.com/fwlink/?LinkId=44441. 1. The Express Installation package is downloaded and run. This package includes installation instructions, the package installer for Windows, and information about the new Webcheck.dll file, but does not contain the new Webcheck.dll version 5.2 file itself. 2. Update.exe takes inventory and discovers an existing Webcheck.dll version 4.9 file on the target computer. 3. Update.exe downloads the Webcheck.dll version 4.9-to-5.2 delta file from the PSF and then creates the new Webcheck.dll version 5.2 from the existing Webcheck.dll version 4.9 and the delta file. 4. Update.exe verifies the integrity of the new Webcheck.dll version 5.2 from its cryptographic signature. 5. Installation proceeds in the same manner as if Webcheck.dll version 5.2 was included in the original package, replacing the 4.9 version with the new 5.2 version. Self-Contained Installation vs. Express Installation A self-contained package contains installer files and new files to be installed within a single self-extracting compressed file. An Express Installation package contains only installer files within a single compressed file; it does not include the new files to be installed. A typical Express Installation does include some additional steps but the installation process is otherwise the same. BDC 14 This table lists the steps that are completed during a self-contained installation versus Express Installation. Sequence Steps Typical self- Typical Express contained Installation installation 1 Update.exe interprets installation instructions (from Update.inf) that define which files should be installed to which locations on the target computer. Yes Yes Update.exe also interprets rules that describe when file replacements are dependent on file version checks or hardware compatibility. 2 Update.exe computes a sequence of file copy operations to be performed from the instructions. Yes Yes 3 Update.exe archives existing files that will be replaced. This provides the capability to uninstall the update. Yes Yes 4 Update.exe determines which new files are required for installation and are not present. No Yes 5 Update.exe inventories the existing versions of the files that will be replaced by the new files and determines which delta files — or in some cases compressed copies of the updated files— should be downloaded to produce the required new files from the existing files. No Yes BDC 15 Sequence Steps Typical self- Typical Express contained Installation installation 6 Update.exe requests the delta file download from the SUS client. No Yes 7 The SUS client then invokes Update.exe to validate the downloaded delta files and generates new files. Update.exe notifies the SUS client that all the files required to install the update are present, or requests some files as described in Step 6. No Yes 8 Update.exe copies the new files to the locations specified in Update.inf. Yes Yes Summary The package installer for Windows can conduct Express Installations using Binary Delta Compression (BDC) technology to reduce the download size of software update packages. This technology can significantly decrease total download size and time for computers with slower network connections. For Windows XP and Windows Server 2003 SP1, these Express Installations use BITS to conduct file downloads so that the process is managed to preserve the responsiveness of other network applications, and installation will automatically resume in case the computer is restarted or if network connectivity is disrupted for any other reason.