ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

Disk write cache (Windows XP)

<< < (2/2)

vlastimil:
Agree with 4wd. Even with write caching enabled, the data should be physically on the disk within few seconds. The problem you are describing is likely related to something else, maybe the application they are using.

Giampy:
(or that they are not saving the data every so often).
-4wd (May 28, 2012, 07:45 AM)
--- End quote ---
The problem you are describing is likely related to something else, maybe the application they are using.
-vlastimil (May 28, 2012, 08:38 AM)
--- End quote ---

Those colleagues perfectly know that it's necessary to save every while. I can't believe that they forgot to do it.

Trouble of colleagues apart, you assert the data are written to the HD within a short time anyway, even if the cache is enabled. But are you sure? If that were true, then I don't understand why Microsoft and other people report the dangerousness of an enabled cache (i.e. loss of data).

4wd:
Trouble of colleagues apart, you assert the data are written to the HD within a short time anyway, even if the cache is enabled. But are you sure? If that were true, then I don't understand why Microsoft and other people report the dangerousness of an enabled cache (i.e. loss of data). -Giampy (May 29, 2012, 07:02 AM)
--- End quote ---

The thing is you have said that the system loses data during a power failure, hours after it was supposedly written.  If it was the case that Windows only flushed the cache every few hours you would have had literally thousands, (if not millions), of customers screaming their heads off about the unreliability of Windows disk writes.

I live in an area that is subject to reasonably frequent power failures, (high winds, overhead power lines and trees don't mix), and I can say that with both XP and Win7 I have never lost data that was written hours previously, (I don't have a UPS - never needed one).  One of my machines does nothing but download 24/7 and it never loses more than 8MB of data, (size of the cache of the program), and that 8MB is written out to the drive every minute or so.

From Microsoft: File Caching

The frequency at which flushing occurs is an important consideration that balances system performance with system reliability. If the system flushes the cache too often, the number of large write operations flushing incurs will degrade system performance significantly. If the system is not flushed often enough, then the likelihood is greater that either system memory will be depleted by the cache, or a sudden system failure (such as a loss of power to the computer) will happen before the flush. In the latter instance, the cached data will be lost.

To ensure that the right amount of flushing occurs, the cache manager spawns a process every second called a lazy writer. The lazy writer process queues one-eighth of the pages that have not been flushed recently to be written to disk. It constantly reevaluates the amount of data being flushed for optimal system performance, and if more data needs to be written it queues more data. Lazy writers do not flush temporary files, because the assumption is that they will be deleted by the application or system.
--- End quote ---

So, in theory, given a finite amount of data that has been cached, it should all have been flushed to the drive after ~8 seconds.

This is for data written from the Windows RAM based cache to the drive, the drive reports that the data has been written even though it may be sitting in the drives cache and not on its physical platters.

ie. Disabling the Write Cache under the Drive Properties will not disable the drives onboard cache, AFAIK.

If data is being lost hours after it was supposedly written, then given that no one has tampered with Windows cache manager settings it seems likely there is another problem.

Have you looked at the Event Log for disk based errors/warnings and possibly any related to specific programs that lose data, (do those programs have error logs - if so, check them) ?
Is it only happening to one computer ?

MilesAhead:
Just as an aside, I don't know if any MS servers are still configured this way, but I remember when I ran NT 4 Server I got a kick out of the fact that every little disk write I could hear the data flushed to the HD. If I wrote a 10 byte .ini file I could hear it write to the HD right away.  Made me laugh.

But like the other responses, I don't understand how you could cache disk data for hours. For one thing the file system cache would be using up most of the ram on the system. As for the UPS, only business industrial size could maintain power for a long period of time. The home use types typically can keep you going for several minutes. Long enough to save your data and shut down. If it took hours, none of those UPS would work.

I would invest in a UPS. Even with write caching disabled, it the power goes out in the middle of the disk write, it's going to scramble the data. It's worth it, even if you can only afford one of the cheapie brands.

edit: the only situation that comes to mind where losing a few seconds of disk write might "destroy hours worth of work" would be some long math calculation. Say if you were calculating an MD5 Sum for a 800 GB file. Unless you process it all, it's gone.  Seems it would have to be a pretty specialized circumstance similar to that case.

Giampy:
Inside your replies I find encouraging words. I get to thinking those warnings about the dangerousness of the cache are a little alarmist or I have given too much weight to them.

Navigation

[0] Message Index

[*] Previous page

Go to full version