Results 1 to 18 of 18
  1. #1
    Secondary Hivemind Nexus
    Join Date
    Jun 2011
    Posts
    4,739

    HDD (not SSD) Write Caching - anyone up on this?

    I've had an intermittent problem on this (W7 64) system for eons in that, from time to time, the HDD light will come-on solidly and the system becomes 'unresponsive' whilst it's on.

    I've run diagnostics and resource monitors and NOTHING is accessing the disc more or less than normal at the time - CPU usage is usually low too. This 'freeze' lasts anything from 2-3 seconds to 20 seconds and it's bloody annoying (and highly intermittant - sometimes 10 times a day - sometimes not for days).

    I've disabled and changed allsorts of settings/programs/other stuff but nothing has resolved it thusfar. I even swapped the HDD (copying Windows to a new drive) and that didn't solve it either (I also changed the cable and the SATA socket!)

    Tonight I think I might finally have an idea what's causing it tho - write-caching. W7 has 2 separate options in relation to this (Device Manager/HDD/Properties/Policies) - the "Quick Removal/Better Performance" options - which I believe control what caching Windows does - and the "Enable Writing Caching" policy which I think controls caching on the drive itself!?

    As an experiment, I disabled the latter - and interestingly enough, doing it caused the system to do a 'freeze' - the symptoms in the Resource Monitor were identical (100% HDD usage - almost no IO or CPU) for about 15 seconds - this may just be a fluke but only time will tell.

    What I wanted to ask tho is - does anyone know the innards of those 2 policies - the significance of the latter option (HDD?) over the other policies (Windows?) and what the upshot of disabling them might be?

    Note: I've no desire to eject the system HDD - nor is it in any way a bottleneck to the system - e.g. I don't think I'll miss the caching!?

    TIA

  2. #2
    Secondary Hivemind Nexus mashakos's Avatar
    Join Date
    Jun 2011
    Posts
    1,255
    Sounds like a power management issue to me. Can you confirm if you have disabled hard disk sleep completely first?
    Steam profile
    PC Specs: I have a big e-peen

  3. #3
    Secondary Hivemind Nexus
    Join Date
    Jun 2011
    Posts
    4,739
    Quote Originally Posted by mashakos View Post
    Sounds like a power management issue to me. Can you confirm if you have disabled hard disk sleep completely first?
    Yeah I've been through that one - more than twice, in fact :)

    I also changed the PSU on this system - and tested the RAM. The thing is tho, it's never crashed, it just has a regular 'go slow' and there are dozens and dozens of people out there with similar issues (but no consistent solution).

    After this my next target is VSS - I've already found and fixed something weird with Windows Restore Points (it thought it had 2 C: drives for some weird reason) but VSS is an obvious culprit anyway

    After that, I'm going for a clean install of W7 but that's a last resort really - and if that doesn't fix it - new pC! :)

    p.s. I suspect the problem is actually related to swapfile abuse - I've got 4Gb of RAM which has always been OK upto now, but I'm starting to work on some stuff which hogs memory and I've noticed I'm running over 75% physical memory a lot of the time -so more RAM will probably help too...

    AND as I've eliminated the HDD as a cause I'll put the 2nd HDD back in and use it as a swapfile drive perhaps...
    Last edited by trjp; 03-11-2012 at 03:48 AM.

  4. #4
    Secondary Hivemind Nexus mashakos's Avatar
    Join Date
    Jun 2011
    Posts
    1,255
    Quote Originally Posted by trjp View Post
    Yeah I've been through that one - more than twice, in fact :)

    I also changed the PSU on this system - and tested the RAM. The thing is tho, it's never crashed, it just has a regular 'go slow' and there are dozens and dozens of people out there with similar issues (but no consistent solution).

    After this my next target is VSS

    After that, I'm going for a clean install of W7 but that's a last resort really...
    Could be related to an external drive? I've had a Buffalo Drivestation do this to me, it had a hardcoded sleep duration of 30 minutes in the firmware. Any time something in the drive needs to be accessed, it's usually in sleep mode and takes 2-3 seconds to wake up. The whole system freezes until the drive is awake.
    Steam profile
    PC Specs: I have a big e-peen

  5. #5
    Secondary Hivemind Nexus
    Join Date
    Jun 2011
    Posts
    4,739
    These freezes are way longer than that sometimes - and I've tested this with pretty-much nothing else attached.

    I think it's just 'thrash' - with caching disabled, you see the HDD working hard when you expect it to (e.g. loading a game or saving files) wheras with it enabled it defers the work until later (which is why you get pregnant pauses when you least expect them).

    Right now I'm running Windows - all my data/games and the swapfile on a single HDD and it's painfully slow at times - I'll get the 2nd HDD back in and get the swapfile over to that and see if things improve a bit.

    I reckon this all started when I switched from IDE to ACPI - Windows is probably still in a huff about that - I'm thinking of a processor upgrade next month, I'll do a clean install with that and we'll see if things improve again - perhaps!?

  6. #6
    Secondary Hivemind Nexus
    Join Date
    Jun 2011
    Posts
    4,739
    p.s. I've also just noticed that I've got a fixed 3Gb swapfile which is probably not enough (usual rule is 1.5x RAM)??

  7. #7
    Secondary Hivemind Nexus mashakos's Avatar
    Join Date
    Jun 2011
    Posts
    1,255
    Quote Originally Posted by trjp View Post
    p.s. I've also just noticed that I've got a fixed 3Gb swapfile which is probably not enough (usual rule is 1.5x RAM)??
    Are you referring to pagefile.sys or hiberfil.sys?

    I think you mean AHCI, if so you need to set some stuff up in windows if you initially installed Win7 in IDE mode:
    http://www.sevenforums.com/tutorials...s-7-vista.html
    Steam profile
    PC Specs: I have a big e-peen

  8. #8
    Network Hub
    Join Date
    May 2012
    Posts
    126
    Write-caching is simply a way of letting your physical RAM modules take some of the load of your storage. Write-actions which would normally (With write-caching disabled) be queued in your HDD's buffer are now stored in volatile memory.

    Enabling it should give you better performance when your machine has to do a lot of write-actions, but in extremely rare cases a power failure could corrupt a file, multiple files or system files that were undergoing write-actions.

    What you could try is disabling the regular emptying of the write-cache - there should be an option to disable write-cache buffer flushing in the same area where you enable write-caching.

    As for virtual memory/pagefile - I've had it disabled ever since RAM got cheaper than a bag of potatochips, as I can not find any proof that having to use a HDD (Or SSD in my case) instead of the massively faster volatile memory is advantageous. Virtual memory by all right should be a thing of the past in modern desktop operating systems imo

  9. #9
    Secondary Hivemind Nexus
    Join Date
    Jun 2011
    Posts
    4,739
    Yes AHCI - and yes, I had to fiddle W7 to make it work again! :)

    Disabling pagefiles is pretty controversial isn't it? It isn't "using an HDD as memory" - it's "keeping recently used things somewhere handier than their original location" surely? I know some quite hardcore Windows techy people reckon it's still worth having a pagefile - even if you have a tonne of memory (and this system is DDR2, the cost of which is escalating again?)

    I'm not sure how much memory would be 'enough' either - I've always thought of 4Gb as quite a lot of memory (having had a whopping 2Gb before this system) but even with 8Gb I can see situations where you'd want to keep stuff 'handy' because there wasn't space in memory for it (I regularly edit multi-Gb files - for example).

    I've also dug into the caching and what I've done is disable caching on the drive but NOT in Windows itself. If I re-enable that, I get the option to disable Windows periodically flushing the HDD cache BUT that means in the event of a power failure, the odds of losing data are higher.

    There is a notable performance drop with HDD caching disabled tho - game loading is noticably slower (I guess because the drive is having to do writes at the same time as reads instead of deferring them until it's not so busy).

    Hmmmm - more tinkering required here I think. I'm 99% convinced it's buffer flushing which is causing these pauses tho - it does one when you disable the write cache and the symptoms are identical...

  10. #10
    Lesser Hivemind Node Feldspar's Avatar
    Join Date
    Jan 2012
    Posts
    634
    You could get a similar result with a dodgy connection on the SATA lead, might be worth checking/swapping the lead just to eliminate this.

  11. #11
    Secondary Hivemind Nexus mashakos's Avatar
    Join Date
    Jun 2011
    Posts
    1,255
    This is an interesting puzzle!
    What motherboard are you using, and which motherboard/chipset driver version do you have installed?
    Steam profile
    PC Specs: I have a big e-peen

  12. #12
    Secondary Hivemind Nexus
    Join Date
    Jun 2011
    Posts
    4,739
    Quote Originally Posted by Feldspar View Post
    You could get a similar result with a dodgy connection on the SATA lead, might be worth checking/swapping the lead just to eliminate this.
    Done that twice :)

  13. #13
    Secondary Hivemind Nexus
    Join Date
    Jun 2011
    Posts
    4,739
    Quote Originally Posted by mashakos View Post
    This is an interesting puzzle!
    What motherboard are you using, and which motherboard/chipset driver version do you have installed?
    It's a k10n78 board - running the nVidia all-in-one driver download from ASRock (there may be more up-to-date drivers from nVidia for the board - I've not looked tho)

    p.s. the nVidia site 'motherboard detect' plugin doesn't work on this system, but I quick dig around in Device Manager and I noticed something...

    The SATA/IDE controllers were all Windows default ones and not nVidia ones. I suspect this comes from when I switched from IDE to AHCI - because the nVidia 'all in one' driver leaves an uninstaller behind and it's still there.

    SO I re-ran it - it grumbled and forced 2 restarts and now it's showing nVidia drivers for the SATA/RAID/IDE/SCSI device controllers (it announces my HDD to be SCSI for some reason, in fact!)

    We'll see iif that makes a difference then - thanks for the tip
    Last edited by trjp; 04-11-2012 at 07:26 PM.

  14. #14
    Secondary Hivemind Nexus
    Join Date
    Jun 2011
    Posts
    4,739
    Well it's been a few days and I'd have to say that driver uninstall/reinstall seems to have cracked it - which is a relief because a reinstall would have been a nightmare (and bloody annoying given that this system is backed-up 16-ways-to-tuesday to avoid just that).

    I was actually sitting on the button to buy a new laptop (to move everything across to before doing the reinstall) - it was THAT close.

    So - tip of the week, when moving your PC from IDE to AHCI, remember to reinstall the Mobo drivers...

    THX for the tips and tricks!

  15. #15
    Secondary Hivemind Nexus Boris's Avatar
    Join Date
    Apr 2012
    Location
    Netherlands
    Posts
    1,401
    Quote Originally Posted by trjp View Post
    Yes AHCI - and yes, I had to fiddle W7 to make it work again! :)

    Disabling pagefiles is pretty controversial isn't it? It isn't "using an HDD as memory" - it's "keeping recently used things somewhere handier than their original location" surely? I know some quite hardcore Windows techy people reckon it's still worth having a pagefile - even if you have a tonne of memory (and this system is DDR2, the cost of which is escalating again?)

    I'm not sure how much memory would be 'enough' either - I've always thought of 4Gb as quite a lot of memory (having had a whopping 2Gb before this system) but even with 8Gb I can see situations where you'd want to keep stuff 'handy' because there wasn't space in memory for it (I regularly edit multi-Gb files - for example).

    I've also dug into the caching and what I've done is disable caching on the drive but NOT in Windows itself. If I re-enable that, I get the option to disable Windows periodically flushing the HDD cache BUT that means in the event of a power failure, the odds of losing data are higher.

    There is a notable performance drop with HDD caching disabled tho - game loading is noticably slower (I guess because the drive is having to do writes at the same time as reads instead of deferring them until it's not so busy).

    Hmmmm - more tinkering required here I think. I'm 99% convinced it's buffer flushing which is causing these pauses tho - it does one when you disable the write cache and the symptoms are identical...
    Yes. You should always have a bit of swap. Windows can swap out pages you do not need to make room for more disk cache. Disk cache is good. Even if you have 32GB of RAM, let Windows have some swap. 1,5x your RAM size is way excessive though. A few gigabytes is usually enough. Windows is actually pretty decent (but not great) at guessing which size you need.

    The reason the thing is slower without write-caching is that with write caching off, you force the hard drive to handle each write request immediately. This means the head has to swing around to the place the write is going to be, then swing back to what it was reading. Given that moving the heads and waiting for the right part of the disk to spin under it can take about 10 milliseconds, this means you add 20ms delay every time there's an itty bitty write. This can add up fast.
    Last edited by Boris; 11-11-2012 at 10:03 AM.

  16. #16
    Secondary Hivemind Nexus
    Join Date
    Jun 2011
    Posts
    4,739
    That's interesting - I've often wondered about the value of on-disk cache memory in relation to that too (presumably its that cache you're disabling when you disable on-device caching - because that cache memory is lost in a power-failure situation?)

    I recently replaced an HDD in a laptop - it had a 5400RPM 8Mb cache HDD but I was putting a 7200RPM 16Mb cache drive in and so I took the opportunity of testing them back-to-back and - well - there was VERY little difference between them, tbh...

  17. #17
    Secondary Hivemind Nexus
    Join Date
    May 2012
    Posts
    1,444
    You should be looking at GBs of cache, not MB. You won't get those on the HDD, but adding them to a PC system should be trivial. Going to check it over next week, will post if it works. :P

  18. #18
    Secondary Hivemind Nexus Boris's Avatar
    Join Date
    Apr 2012
    Location
    Netherlands
    Posts
    1,401
    Quote Originally Posted by trjp View Post
    That's interesting - I've often wondered about the value of on-disk cache memory in relation to that too (presumably its that cache you're disabling when you disable on-device caching - because that cache memory is lost in a power-failure situation?)

    I recently replaced an HDD in a laptop - it had a 5400RPM 8Mb cache HDD but I was putting a 7200RPM 16Mb cache drive in and so I took the opportunity of testing them back-to-back and - well - there was VERY little difference between them, tbh...
    The cache you disable when you disable the "write-cache" is the, well, write cache. The options are labelled correctly, but might be misleading if you're not introduced to operating system inner workings.

    The write cache is a piece of memory that exists in main RAM. When you write to a file, the write can come in in little chunks. Windows can wait to collect more chunks by putting them in the write-cache. By doing so, it can reorder the chunks so the HDD has to spend the least amount of movement on the disk to write them all. It can also find a contiguous block of free space for them to all fit. For example, if you write a 1MB file and wait to have it all in cache, you can find a nice 1MB block of free space to put it in without fragmenting it.

    If you disable the write cache, any writes will go to disk immediately. This is a good feature for slower disks where sudden unavailability is a concern, like flash drives. That's why drives marked as removable storage always have the write-cache off by default. Because that way, when you press save in Word, the file will be committed to that drive immediately. This is great if you're the kind of person who just yanks out flash drives instead of cleanly unmounting (safe remove) them. (All clean-unmount does is force all writes in the cache to disk and releases all the open "handles" it has on the files).

    The 8MB cache you see HDDs advertised with is not a cache you should disable in Windows (and I don't think a lot of drives even let you). The drive mainly uses it for reads, because there's a command the operating system can give that will force the drive to write to disk. It uses it for reads because when you request a sector of data, there's a high chance you'll also want the next one. The drive just reads ahead for you and stores it in cache, on the assumption you will want the next sector anyway (and the next and the next). This increases read speed, because otherwise you'd have to wait for the drive to spin around again.
    It is used for writes, but again, only to decrease the time the data has to stay in volatile memory (memory that goes bad if you pull power).

    The reason you barely see difference with those two drives is that disk RPM only party plays into latency for a read or write. Visualize it: When you want it to read/write a particular place on disk, two things have to happen:
    1) The head needs to swing around to that place.
    2) The head needs to wait for the part of the platter it needs to rotate under the head.

    So more RPM only increases the speed of part 2, and only by 3 milliseconds (!) in the best case (that's the difference in speed of one rotation between 7200 and 5400 RPM). The rest of the seek (as this operation is called) takes around 2-3 times as much time, so there's little gain there. The only thing more RPM does is increase your linear read/write (you want one big file that's in one piece on disk, its faster at that, because more data flies under its head per second).

    As RPM increases, so does power consumption and manufacturing cost. So there's little gain and a few big downsides, so manufacturers are quite content to sell you slower spinning drives under the eco or green labels. And they're actually a good choice. Especially if you use an SSD for your OS and applications.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •