Windows Server 2012 write caching

cachedisk-cachewindowswindows-server-2008windows-server-2012

From MSDN:

By default, Windows caches file data that is read from disks and written to disks. [..] Caching is managed per file object. The policy of delaying the writing of the data to the file and holding it in the cache until the cache is flushed is called lazy writing, and it is triggered by the cache manager at a determinate time interval. [..] The time at which a block of file data is flushed is partially based on the amount of time it has been stored in the cache and the amount of time since the data was last accessed in a read operation.

My question is how long does it take Windows to "really" write a file on disk?

Best Answer

The time scale of write caching is generally seconds or less. A section from the Windows 2000 Performance Guide contains the following details:

The Cache Manager program documents a series of constants that are used in the lazy write algorithm. These include CcFirstDelay, which delays writes three seconds after their first access; CcIdleDelay, which triggers writes one second into an idle period; and CcCollisionDelay, which triggers a 100-millisecond delay if a speculative lazy write encounters a disk busy condition. As of this writing, it is not certain if these parameters that control Cache Manager operation were carried forward into Windows 2000, but it seems likely they were.

It's likely that write-caching in modern Windows versions is significantly faster, though I can't put my hand on any documentation to that effect, and it generally doesn't matter. If it's a problem, something else is very wrong, which is why people aren't generally concerned with the precise timing details.