1

I'm looking to maximise performance of my hard drive by enabling write caching. I understand the risks in doing this, but believe them to be insignificant for how I will use it.

On the HD Properties tab in Windows, the last two options are a bit confusing:

Enable write caching on device - ok, but how does that work in conjunction with the previous option? Does it override windows caching or work alongside it?

Turn off Windows write cache - Ok, but why would I do this. And if I tick this box then the Better Performance option is still selected, contradicting itself.

Can someone help clear up exactly what these flags do and how they affect/rely on each other.

enter image description here

userSteve
  • 1,573
  • 4
  • 23
  • 33
  • What makes you think that the performance problem is caused by disk? – Mircea Vutcovici May 10 '17 at 03:12
  • @MirceaVutcovici I don't have a performance problem, I just want to maximise the performance of the harddrive to reduce the chance of a problem in the future – userSteve Nov 29 '17 at 12:17
  • I wouldn't trade data integrity for disk performance unless you do not care of that data and/or your time to make the system again functional. SSDs are cheap. Also spending time in premature optimizations without knowing the workload could be a waste of time. Take those advices as a guideline, I do not know your application/environment/workload. – Mircea Vutcovici Nov 29 '17 at 14:31

3 Answers3

1

The second option isn't "windows caching" as you say, but the inhibition of the "flush" system call: Turn off Windows write cache buffer flushing

This option would disable the flush command called by some application (and on machine shutdown), whose purpose is to effectively write disk cache to the disk.

It won't disable the write cache.

You can try to enable this option, at the risk of data loss, but depending on your context, the performance gain may be not noticeable.

Saïmonn
  • 325
  • 2
  • 8
  • I upvoted this answer, but to restate it in practical terms: The "Turn off Windows write-cache . . ." option removes Windows ability to guarantee data has been written to the disk and not just the disk's onboard cache. Most people don't consider this an acceptable risk. But the decision is yours. – Brandon Xavier May 07 '17 at 17:22
1

Really the difference is highlighted in the Removal Policies. This looks like a similar question to: https://superuser.com/questions/215372/what-does-write-cache-buffer-flushing-mean

1

You have to understand how data is written to disk.

You have a couple of subsystems involved in the process of writing the data from the process to physical disk.

Usually the processes are asking the kernel (the OS) to write something to disk. Also the kernel itself can write some data to disk e.g. as a swap-out operation.

The memory pages that need to be written to disk is kept in a region in physical memory called file system cache and are called dirty pages, and it will be written to disk if one of the conditions is true:

  • the process is asking the kernel to write the data to disk using FlushFileBuffers call
  • after a certain time since the last write to disk
  • if there is no free memory for the file system cache (it is a complex decision made by the kernel if it should discard non dirty pages, write to disk dirty ones, swapping inactive memory pages, etc...)

Now the data will go to disk, but the disk subsystem has 2 components that are important of this explanation:

  • the disk controller, which is the electronic board on the disk
  • the permanent memory which could be magnetic disks or flash memory

Modern disk controllers have some memory modules that are called disk buffer. If this is activated, data flushed to disk subsystem will get written into the disk buffer and the operation will be considered completed by OS and programs, but the data is not yet on disk. The problem with this is that if you reboot your machine you have very high chances to lose data. You might not notice this until you have a filesystem corruption, or database corruption.

Here are some reasons why processes or OS needs to flush the data to disk:

  • they have a journal for a transactional system like a database or filesystem and they need to enforce consistency and integrity for the data written to disk.
  • they finished an important operation, like creating a file anddisk buffer they want to make sure the entire file is on disk
  • bad programming

The current configuration is the best trade off between performance and safety, unless you have an UPS (uninterruptible power supply).

Mircea Vutcovici
  • 17,619
  • 4
  • 56
  • 83