Friday, March 16, 2007

Hard disk slowfox

I've had some problems for the last weeks with the performance of my laptop and was looking around to buy a new one. But since it's a lot of comparing to do, to decide witch one to buy I was not able to find the perfect one so I started to investigate that was causing this. I ignored the usual helpfull comments about Windows slowing down over time, and questions about when I last reinstalled Windows.

I did the standard scans using Ad-Aware and did not find anything alarming. I removed all unneeded startup items from the registry and the start-up folders and stopped all services I could be without, but the computer still felt like an old 386. I was near or at 100% CPU utilisation without getting much work done, something must be broken.

I downloaded a performance measurement tool called PerformanceTest 6.1 to try to get a measurement of how slow my laptop was, and indeed it was slow. I got 1.2MB/s transfer rate to my hard disk. That is not much. I tried the program on my other machine and got 40MB/s. Now I was convinced something was terrible broken.

After a couple of hours of scanning for rootkits and examining all class filters for the hard disk device stack my brother suggested that I checked the DMA settings on the IDE channel. I said sure, let's check, because DMA is always active and I did not suspect it could be disabled. I was running my hard disk on PIO-mode! How could that be?

After another hour of investigations I had found the Microsoft Knowledge Base article KB817472 that explains the problem. If the driver receives errors from the hard disk, it tries to lower the transfer speed over the IDE channel. The real problem starts then using a laptop and you only hibernate the system since you are likely to get some errors then starting up again. My machine had lowered the transfer mode to the lowers PIO-mode where the CPU is used to output a byte at the time to the hard disk, at high cost of CPU cycles and very slow throughput.

The "fix" to this problem was simple, just delete the Primary IDE channel in device manager and reboot, and the system will plug and play the device back again with restored performance. Running PerformanceTest again gave me 25MB/s to the disk.

Microsoft has also added and option to disable this "feature" in the driver, and I think you can guess my setting...

No comments: