How the synchronization in Windows 7 Offline Files works
In this article i will present the way offline files synchronize and focus on Windows 7 enhancements.
To understand synchronization we have to understand the concepts of “auto-caching” and “sparsely-cached” files:
- Auto-cached files are those files that are cached automatically when opened on a server configured to support “automatic caching”. Initially, only those blocks of data read by the client application are cached, producing a “sparse” file in the cache.
- Sparsely-cached files are available to the client only when the associated network share is connected (a.k.a. “online”). In order to make a sparse file available while offline, it must first be “filled” while online. Filling of a sparse file ensures the complete file is in the cache. Most sparse files are automatically filled in the background by the “CSC Agent” so sparse files are rarely an issue. However, since sparse files are unavailable while offline, it is necessary that they be filled prior to disconnecting from the network.
Optimized file synchronization:
One of the performance enhancements of Offline Files in Windows Vista is a faster synchronization process. This is achieved by using a new synchronization algorithm that does the following:
- reduces the time and bandwidth needed to identify differences between the local cache and the server
- determines which parts of a file in the local cache have changed, and then updates only those parts of the file on the network server
The process of updating only parts of a file on the server is called Bitmap Differential Transfer. It takes place during synchronization of the local cache to the server.
Bitmap Differential Transfer
- Offline Files in Windows Vista and Windows 7 uses Bitmap Differential Transfer. Bitmap Differential Transfer tracks which blocks of a file in the local cache are modified while you are working offline and then sends only those blocks to the server. In Windows XP, Offline Files copies the entire file from the local cache to the server, even if only a small part of the file was modified while offline.
Because Bitmap Differential Transfer can make the synchronization more efficient, Offline Files in Windows Vista and Windows 7 supports all file types. Offline Files in Windows XP could not synchronize large files efficiently; therefore, certain types of files were specifically excluded from the local cache.
- Bitmap Differential Transfer is not used when synchronizing changes from the server to the local cache. If a file is modified on the server when you are offline, Offline Files in Windows Vista or Windows 7 will copy the whole file to your local cache during synchronization. Bitmap Differential Transfer works only for pre-existing files and not for files that were created while working offline. Because of this limitation, files modified with applications that do not modify the file in place will not work with Bitmap Differential Transfer. For example, Microsoft® Word creates a temporary file that is used to replace the original file. These types of files are considered new, and they are copied in their entirety from the local cache to the server.
The "Synchronize all offline files before logging off " and "synchronize all offline files when logging on" are no longer available for Windows Vista and Windows 7 : http://technet.microsoft.com/en-us/library/cc749449(WS.10).aspx#BKMK_Optimized . The main reason is the client has cached the file when it has accessed to this file in read mode. Then only the difference (block of data that has changed for a file) is synchronized on a regular bases or when logon (background), logoff and Slow Link change.
What are the settings in Windows 7:
There are some settings with which you can play to ensure client are correctly synchronized before they leave the network (shutdown or logoff) :
- Configure Background Sync : this policy applies only for Windows 7and Windows Server 2008 R2 (offlinefiles.admx)
This is a machine-specific setting which applies to any user who logs onto the specified machine while this policy is in effect. This policy is in effect when a network folder is determined, as specified by the "Configure slow-link mode" policy, to be in "slow-link" mode.
For network folders in "slow-link" mode, a sync will be initiated in the background on a regular basis, according to these settings, to synchronize the files in those shares/folders between the client and server.
By default, network folders in the "slow-link" mode will be synchronized with the server every 360 minutes with the start of the sync varying between 0 and 60 additional minutes. You can override the default sync interval and variance by setting 'Sync Interval' and 'Sync Variance' values. You can also set a period of time where background sync is disabled by setting 'Blockout Start Time' and 'Blockout Duration'. To ensure that all the network folders on the machine are synchronized with the server on a regular basis, you may also set the 'Maximum Allowed Time Without A Sync'. You may also configure Background Sync for network shares that are in user selected "Work Offline" mode. This mode is in effect when a user selects the "Work Offline" button for a specific share. When selected, all configured settings will apply to shares in user selected "Work Offline" mode as well. If you disable this setting or do not configure it, the default behavior for Background Sync will apply.
This would be a short explanation on how the offline files sync works. If you have any questions, please use the comments section to ask them.