Welcome Guest.   Make a donation to an author on the site October 24, 2014, 04:37:26 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
View the new Member Awards and Badges page.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Disk write cache (Windows XP)  (Read 2872 times)
Giampy
Participant
*
Posts: 322


View Profile Read user's biography. Give some DonationCredits to this forum member
« on: May 27, 2012, 07:43:07 AM »

Hail!
The so called "Disk write cache" speeds up the system but I disabled it as certain data get lost if a power failure occors, even if we had performed a Save command.
Is there a way to keep that useful cache and contemporaneously to be sure that every Save command is effective?
Logged

"A refrigerator without beer is like a body without soul"
vlastimil
Honorary Member
**
Posts: 305



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #1 on: May 27, 2012, 10:52:54 AM »

I fear the answer to your question is no. You either wait for the write operation to finish and then you are sure that the data really is on the disk or you let the system write the data a few moments later and have a better performance.

Getting a fast SSD would help  Wink
Logged
Ath
Supporting Member
**
Posts: 2,234



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #2 on: May 27, 2012, 04:29:21 PM »

And getting a battery backed power source helps even better Thmbsup
Logged

Giampy
Participant
*
Posts: 322


View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #3 on: May 28, 2012, 07:08:43 AM »

...or you let the system write the data a few moments later

That's just the point: the system may not save data within a short time. Sometimes it takes even hours. At least two times I heard mprecations from two colleagues of mine when the power failed and they lost hours of job.
Logged

"A refrigerator without beer is like a body without soul"
4wd
Supporting Member
**
Posts: 3,353



see users location on a map View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #4 on: May 28, 2012, 07:45:05 AM »

That's just the point: the system may not save data within a short time. Sometimes it takes even hours. At least two times I heard mprecations from two colleagues of mine when the power failed and they lost hours of job.

That doesn't sound like the Disk Write Cache, that sounds more like they don't have a program that does auto-saves every x minutes, (or that they are not saving the data every so often).

You can go into the Device Manager->Disk Drives and then right-click to open the Properties window for each drive, then go to the Policies tab and turn off Enable write caching on the disk.



This will at least enable you to test whether data is still lost after a few hours - if it is, then you have another problem.

You should also check the Event Log for any disk related errors or warnings, (eg. Delayed Write Fail).
« Last Edit: May 28, 2012, 07:50:37 AM by 4wd » Logged

I do not need to control my anger ... people just need to stop pissing me off!
vlastimil
Honorary Member
**
Posts: 305



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #5 on: May 28, 2012, 08:38:32 AM »

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.
Logged
Giampy
Participant
*
Posts: 322


View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #6 on: May 29, 2012, 07:02:49 AM »

(or that they are not saving the data every so often).
The problem you are describing is likely related to something else, maybe the application they are using.

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).
Logged

"A refrigerator without beer is like a body without soul"
4wd
Supporting Member
**
Posts: 3,353



see users location on a map View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #7 on: May 29, 2012, 08:47:12 AM »

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).

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

Quote
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.

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 ?
Logged

I do not need to control my anger ... people just need to stop pissing me off!
MilesAhead
Member
**
Posts: 4,946



View Profile WWW Give some DonationCredits to this forum member
« Reply #8 on: May 29, 2012, 03:00:32 PM »

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.

« Last Edit: May 29, 2012, 03:07:34 PM by MilesAhead » Logged

"Genius is not knowing you can't do it that way."
- MilesAhead
Giampy
Participant
*
Posts: 322


View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #9 on: May 31, 2012, 06:30:58 AM »

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.
Logged

"A refrigerator without beer is like a body without soul"
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.034s | Server load: 0.06 ]