Slow Disk Performance When Write Caching Is Enabled
- Windows 2000 Service Pack 3 (SP3)
- Windows 2000 Service Pack 2 (SP2) on which you have installed the hotfix that is described in the following Microsoft Knowledge Base article:
- Windows XP
For additional information about this bug, click the following article number to view the article in the Microsoft Knowledge Base:
The hotfix that is described in Knowledge Base article 281672 corrects this bug and causes these commands to be issued to the disk as expected when write caching is enabled. This fix is included in Windows 2000 SP3. A similar fix is also included in Windows XP.
By design, these commands sacrifice some performance for the sake of the safety of critical data. They make sure that critical data is written to the disk immediately. These commands are only issued if write caching is enabled for a specific disk device and if it can be detected by using standard mechanisms. When this safe behavior is enforced for disks that implement write caching, you will experience loss of performance during certain disk operations. See the "More Information" section of this article for more details. Also, on a cluster computer, hard-disk information may not be delivered to a node that takes over a cluster resource when the resource is failed over. Therefore, differences in hard-disk write operation performance between each node occurs.
For Computers That Run Windows 2000Warning: If you implement this fix (by installing the updated drivers and turning on the Power Protected write cache option), protections that are built in to the Windows 2000 disk drivers to make sure that critical data is written to the disk immediately instead of being written to the disk later from the disk's built-in cache are removed. Do not implement this fix unless your computer and any connected hard disks are protected against accidental or inadvertent power loss through hardware design that may include such features as redundant battery-backed power supplies. Contact the vendors of your computer and storage devices to determine the degree of protection afforded by your hardware. Do not implement this fix unless you understand and accept the level of risk that may be involved, and are confident that this risk has been mitigated through appropriate hardware power protection. Also, on a cluster computer, differences in performance of hard-disk write operations to shared disks between nodes can be solved by setting the Power Protected write cache option on each node.
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
Part 1: Install Windows 2000 UpdateA supported feature that modifies the default behavior of the product is available from Microsoft. However, this feature is intended to modify only the behavior that this article describes. Apply this feature only to systems that specifically require it.
If the feature is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the feature.
Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific feature. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site: Note The "Hotfix download available" form displays the languages for which the feature is available. If you do not see your language, it is because the feature is not available for that language. The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
Date Time Version Size File name ------------------------------------------------------- 15-Jan-2003 19:42 5.0.2195.6655 34,832 Classpnp.sys 15-Jan-2003 19:43 5.0.2195.6655 30,768 Disk.sysNote The files that are included in this hotfix have post-SP3 version numbers, but they can be used on both Windows 2000 SP2-based and Windows SP3-based computers. The hotfix package will install on both Windows 2000 SP2-based and Windows 2000 SP3-based computers.
Part 2: Configure the "Power Protected" Write Cache OptionAfter you install the Windows 2000 update and then restart your computer so that the updated drivers are loaded, you must also turn on the Power Protected write cache option for each disk that has write caching enabled and has its write cache protected against accidental loss of power. If the Power Protected write cache option is not turned on, this update does not implement any change in disk behavior or performance.
To configure the Power Protected write cache option on the selected disks, use the Dskcache.exe tool. Dskcache.exe is available separately. For additional information about the Dskcache.exe tool and how to enable the "power protected" write cache option, click the following article number to view the article in the Microsoft Knowledge Base:
For Computers That Run Windows XPBecause of design differences between Windows 2000 and Windows XP, there are currently no plans to release a supported update for this behavior for Windows XP.
There are two commands that are typically used to force cached data to be written to the physical disk immediately:
- A flush buffers command, which is available for SCSI and IDE/ATAPI disk devices, instructs the disk to write all cached data to the disk immediately. For SCSI disks, this is implemented by issuing the SYNCHRONIZE CACHE command to the disk. For IDE/ATAPI disks, the FLUSH CACHE command is sent to the disk. This command is typically issued as a result of a Windows program calling the FlushFileBuffers API. Writing to the registry is an example of an operation that results in the FlushFileBuffers API being called and the SYNCHRONIZE CACHE command being sent to the disk.
- A Write Through command, which is only available for SCSI disk devices, is implemented by issuing a WRITE command to the disk with the ForceUnitAccess (FUA) bit set. This type of command instructs the disk to write the current packet of data to the disk immediately, bypassing the onboard write cache. This typically occurs as a result of a Windows program that calls the WriteFile API to write to a file it has opened by calling the CreateFile API with the FILE_FLAG_WRITE_THROUGH flag set. Virus-scanning software typically opens files with the FILE_FLAG_WRITE_THROUGH flag set. Support for the FUA bit is optional, and only some SCSI and Fiber Channel (FC) devices, typically individual drives (as opposed to RAID arrays), implement this functionality.
In Windows 2000 versions earlier than SP3, these commands are not correctly issued to disk devices when expected. For example, the SYNCHRONIZE CACHE command is not issued to a disk when a program calls FlushFileBuffers, and the FUA bit is not set for WRITE commands when the file is opened with FILE_FLAG_WRITE_THROUGH set. The hotfix that is described in Knowledge Base article 281672 corrects this problem, so that these commands are issued as intended and, as a result, provide the expected protection against loss of such critical data.
Note Microsoft SQL Server uses FILE_FLAG_WRITE_THROUGH extensively on local database data, log files, and backup files. Local database data may include data on SCSI drives and SAN drives, but not data on NAS drives. If the Power Protected Storage feature is not enabled on hardware that protects its write-through cache, SQL Server's performance can be affected during the checkpoint process of a large database.
When the Write Cache Enabled option is configured for a disk device in Device Manager, two things occur:
- A command to turn on or turn off Write Caching is sent to the disk device.
- A registry value is saved, which the disk driver uses to determine whether or not to issue write-cache-management commands (Flush, Write-Through) to the disk.
The following table summarizes the effects of the Write Caching and Power Protected options:
|Write Caching|| Power Protected ||Effect|
|Disabled||N/A|| Disk does not cache writes. |
Driver does not issue Flush/Write-Through commands.
(Only behavior possible for drives that do not have write caching enabled in hardware.)
|Enabled||Disabled|| Disk caches writes. |
Driver issues Flush/Write-Through commands.
(Default behavior as of SP3, and with this update applied, for drives that have write caching enabled in hardware.)
|Enabled||Enabled|| Disk caches writes. |
Driver does not issue Flush/Write-Through commands.
(Behavior resulting from pre-SP3 bug, for drives that have write caching enabled in hardware.)
Article ID: 332023 - Last Review: 12/07/2015 13:09:43 - Revision: 12.2
- kbnosurvey kbarchive kbautohotfix kbhotfixserver kbfix kbbug kbqfe KB332023