`

Description of the hard disk cache

 
阅读更多

转自:http://smallvoid.com/article/hard-disk-cache.html

 

The hard disk is extremely slow compared to physical memory (RAM), but provides lots of storage capacity. Disk caching can be used to speed up the harddisk performance. The disk cache uses RAM to provide quick access to frequently accessed data.

There are different levels of disk caching:

  • Hard disk Cache - Cache is located on the hard disk device and works only with sectors. It allows continuous reading from the disk even if the transfer-bus is busy.
  • Disk controller Cache - Cache is located on the controller card and works only with sectors. It allows reading from disk without using the transfer-bus to contact the hard disk.
  • Operating System Cache - Using RAM as hard disk cache and works on a file level. It allows file access without using the system-bus to contact the disk controller.
  • Vista Readyboost - Cache is placed on high speed USB flash drives, which allows faster seek times and higher constant transfer rate than the HDD. Can deliver a very large and fast hard disk cache, though still slower than RAM.
There are usually two types of disk caching:
  • Read Cache - Allows the hard disk to read data ahead in the background, so the application doesn't have to block while waiting for the data to be read, but gets the data delivered from the cache instead.
  • Write Cache - Allows the hard disk to lazy write data in the background, so the application doesn't have to block while waiting for the data to be written, but enters the cache where it is later written to the hard disk.
How does write caching work?
Disk caching greatly improves disk performance, but there is a drawback to Write caching, as anything written to the cache, which haven't been flushed to the disk will be lost when the power is lost. Most applications are aware of this behavior, and the operating system provides the ability to perform a direct write or flushed write. Write flushing means that the application will wait for the data to be written to disk before continuing, instead of just writing to the cache which completes right away.

Windows 3.11 had a flaw in its flush operation, so it actually just performed a lazy write to the cache when an application performed a flushed write. Several applications was created which was littered with flushed writes, because it performed so well. These applications performed miserable when used on Windows 95, which didn't have this flaw when performing flushed write, and naturally was much slower than just writing to the cache. One could activate the old buggy behavior by with the option to "Disable Synchronous Buffer Commits", which was hidden away in the troubleshooting section.

Later as server environments have become more and more stable with duplicate power supplies and UPS equipment, then the idea of actually ignoring the flush request has become a wish for those where high disk performance is critical. The Windows operating system can convert the following requests to normal I/O requests so the cache buffers are not flushed:
  • Write Through - Performs a write to disk without using the cache. Activated by calling the Windows API WriteFile() with FILE_FLAG_WRITE_THROUGH. Sends a Forced Unit Access (FUA) command to the storage device.
  • Flush Buffers - Tells the disk to flush everything it has in cache. Activated by calling FlushFileBuffers(). Sends a Synchronize Cache (SCSI) or Flush Cache (IDE/ATAPI) command to the storage device.
When to enable write caching?
The promise of increased performance is always nice, but when the price is the risk of dataloss, then one should be very carefull with changing the behavior of these disk requests.

It is not recommended to enable write caching on standard desktop/laptop machine, which can shutdown unexpectedly or freeze/crash because of a software/hardware error.

It is also not recommended to enable write caching when running a Database Management System (DBMS), as these requests are used to create stable commit checkpoints before beginning on a new transaction.

But if having a seperate harddisk for the pagefile or other temporary files, then there can be a performance boost with no cost.
How to configure write caching?
  • Windows 2000 SP3 / XP SP2 - Requires the utility Dskcache.exe to enablePower Protected write cache. More Info MS KB Q811392MS KB Q332023
  • Windows 2003 / Vista - The option with the misleading name "Enable Advanced Performance", which can be found on the "Policies"-tab for each hard disk device in the "Device Manager" (Have to activate "Optimize for performance" and "Enable write caching on the disk").
  • Windows 7 - The option is called "Turn off Windows write-cache buffer flushing on the device.", which can be found on the "Policies"-tab for each hard disk device in the "Device Manager" (Have to activate "Enable write caching on the device")

More Info MS KB Q324446
More Info Microsoft - Windows Confidential: The Power of Bugs

Related Configure IDE ATA hard disk for best performance

 

 

附:

Disk buffer

http://en.wikipedia.org/wiki/Disk_buffer

分享到:
评论

相关推荐

    Pyramidal Implementation of the Lucas Kanade Feature Tracker Description of the algorithm

    **Pyramidal Implementation of the Lucas Kanade Feature Tracker** Lucas-Kanade (LK)光流法是一种经典且广泛使用的图像序列特征追踪算法,由Bruce Lucas和Takeo Kanade在1981年提出。该算法基于小运动假设,即...

    A Description of the Fundamentals of Analog Electronics

    A Description of the Fundamentals of Analog Electronics

    Is Everything a Number? -A Description of the Analytical Introdu

    Is Everything a Number? -A Description of the Analytical Introdu

    ANSI IES TM-25-2020 Ray File Format for Description of the Emiss

    ANSI IES TM-25-2020 Ray File Format for Description of the Emission Properties of Light Sources.pdf

    IEC 61000-2-1 description of the environment; electromagnetic

    IEC 61000-2-1 description of the environment; electromagnetic environment for low-frequency conducted disturbances and signalling in public power supply systems.pdf

    Qemu-1.0.1 for windows

    'disk_image' is a raw hard disk image for IDE hard disk 0 Standard options: -h or -help display this help and exit -version display version information and exit -machine [type=]name[,prop[=value][,.....

    Description of STM32F1 L4 L4+ G0 HAL and Low-layer drivers.rar

    Description of STM32F1 L4 L4+ G0 HAL and Low-layer drivers STMCubeTM is an STMicroelectronics original initiative to make developers' lives easier by reducing development efforts, time and cost. STM32...

    Description of STM32F4 HAL and LL drivers.pdf

    ### STM32F4 HAL 和 LL 驱动概述 #### 一、引言与背景 随着嵌入式系统在各个领域的广泛应用,开发工具和软件的重要性日益凸显。STMicroelectronics 推出的 STM32CubeTM 系列,旨在简化开发流程、减少时间和成本...

    硬盘检测工具HD破解版

    Hard Disk Sentinel gives complete textual description, tips and displays/reports the most comprehensive information about the hard disks and solid state disks inside the computer and in external ...

    archlab description

    archlab description This is a trimmed down version of ... Note that you will apply similar ideas in the Cache lab, where you will be making use of SSE instruction extensions to the X86 instruction set.

    An In-Depth Analysis of the Security of the Connected Repair Shop

    First, a system description of the repair shop is given. Security objectives and assets are then identified, followed by the threat and vulnerability analysis. Possible countermeasures are derived ...

    BURNINTEST--硬件检测工具

    - Disk space: 6 Meg of free hard disk space (plus an additional 10Meg to run the Disk test) - DirectX 9.0c or above software for 3D graphics and video tests (plus working DirectX drivers for your ...

    Robust Control with Matlab Code

    servo system of Hard Disk Drive (Chapter 10). column M-files for design and analysis of robust control system of high purity Distillation Column (Chapter 11). rocket M-files for design and...

    Turbo C 2.00[DISK]

    Hard Disk - This option allows you to pick the subdirectories where the files will be loaded. It will create a TURBOC.CFG file based on those directories. 2. Update from TC 1.5 - This allows for ...

    Description of HAL drivers.zip

    Description of STM32F1xx HAL drivers Description of STM32F4xx HAL drivers Description of STM32F7xx HAL drivers 三个HAL库函数手册,英文版的。

    AVG 破解版

    The required reproductions include installation of the software on the hard disk of the implemented hardware and loading the software into the main memory. 2. The Licensee may copy the individual ...

    The Art of Computer Programming MMIX

    This multivolume work on the analysis of algorithms has long been recognized as the definitive description of classical computer science. The three complete volumes published to date already comprise ...

    【正版】ISO 9613-2-1996.pdf

    The ISO 1996 series of standards specifies methods for the description of The ISO 1996 series of standards specifies methods for the description of The ISO 1996 series of standards specifies methods ...

Global site tag (gtag.js) - Google Analytics