Sunday, January 31, 2010

Windows 7 Slow PS/2 Keyboard Scrolling

Howto: Windows 7 and Vista's default keyboard driver seems too slow; scrolling and cursor speeds lag.

Symptoms:
On a Windows 7 (and Vista) machine, I noticed cursor-scrolling speeds were too slow. Pressing the down-arrow key in a long document lagged. This problem is particularly noticeable if you have an old-style PS/2 keyboard with a DIN plug.

If you have a laptop and it cannot keep up with your typing or if keystrokes are skipped; keystrokes not registered, or slow typing on screen, then you likely have a bad battery. Details, below.


Solutions:There are several possible solutions to this problem, with the most likely listed first. Try each solution with a reboot to see if the problem has been resolved.

1. Laptop Battery:

Oddly, a bad laptop battery can cause keyboard problems, where some letters are skipped (this is somewhat different than a slow keyboard). Microsoft's power API goes a little crazy as it receives thousands of power-management interrupts; this impacts the keyboard's speed. See this link.

Testing is easy: Remove the laptop battery, running only on A/C. Reboot. If the keyboard speed improves, it is time to buy a new battery.


2. Desktop Bug and Registry hack

For desktop computers with a PS/2 DIN plug keyboard (or with that keyboard and a USB adapter), there is a keyboard bug in Vista and Windows 7 that was originally fixed with a registry change. When Microsoft released Windows automatic update KB977074, the registry change broke and then alternately worked, depending on subsequent Microsoft updates. This is the fix that I am currently running and this resolved my keyboard-speed problem.

Update: Recent Microsoft patches in late April, 2010 or early May, 2010, and again in June, 2010, have done and then undone the changes recommended in this registry hack. I have now switched this solution one way or the other on three separate occasions; each time it fixed the problem. Since June, 2010, it has been solid. Read below for more details.

a. Start, Run, "Regedit"
If the RUN command is not visible, see this link.

b. Tunnel to this key:
Hkey_LocalMachine/System/CurrentControlSet/Services/i8042prt/Parameters

c. On the detail side, "other-mouse-click" a blank area and add a new Dword-32 value. Name the key "PollStatusIterations" (no quotes)

Set value to Hex = 1

Caution, there are other registry keys with similar names.

d. Close Regedit and reboot.

e. If this value is already in the Registry, disable the key by renaming it to "xxPollStatusIterations" (Other-mouse-click, Rename). Reboot and test.

Reason: Depending on which MS patch has been applied, this registry change can re-introduce a slow keyboard problem. You will have to experiment with adding or removing this patch. I've switched this value on or (x) off three times. This is unfortunate. But in each case, it has dramatically fixed scrolling problems.

(Click image for larger view, "Back" to return)

Clearly, Microsoft is having troubles in this area. Expect to return to this value as Microsoft continues to work on this.


3. Keyboard Scrolling Speed

Consider this minor Control Panel change:

Start Menu, Control Panel, Keyboard.
Peg the Repeat Delay and Repeat Rate to the far-right




4. Windows Control Panel "Ease-of-Access" and "Filter Keys"

This is a known-keyboard issue that may have been inadvertently set on by a well-meaning person.

a. Control Panel, "Ease of Access Center"
b. Choose "Make the Keyboard easier to use"
Confirm "[ ] Uncheck "Turn on Filter Keys

While you are here, you should also turn off "[ ] Turn on Toggle Keys by holding down the Numlock key for 5 seconds."

5. Mouse Drivers

Although this article is primarily concerned with keyboard/cursor scrolling speeds, mouse scrolling speeds may also be slow due to default Microsoft Mouse and touch-pad drivers. (The default drivers installed by Windows 7 are inadequate and they should be upgraded.)

Confirm Mouse Drivers are current:
In the Control Panel, under "Mice and other Pointing Devices," look at the installed Mouse Driver's Properties. For most, it should read "Microsoft Intellipoint" or a Logitech driver. If the driver appears to be a generic Microsoft PS/2 driver, you should upgrade:
This article does not contain a link for Logitech drivers.

Similarly, for laptops, confirm the Touchpad drivers are current. Two common vendors are Alps Touchpad and Synaptics. For my Dell computers, with Windows 7 x64, here is the link I have used: Dell Vista 64-bit Alps. Ideally, download the specific driver for your brand of computer; I have no confidence the Dell driver works everywhere (reader comments?). I keep current 64-bit driver information in this article: XPS M1530 Windows 7 64-bit Drivers (be aware this is for a particular laptop).

6. Video HotKey Drivers - ATI2EVXX

If you have an ATI video card (see Control Panel, Device Manager, Display Adapter), the Video Card ATI service, ATI2EVXX.exe causes Keyboard problems and this program should be un-installed. ATI2EVXX is a hot-key polling service and is not needed because all of its features can be accessed via the control panel.

To disable the program, un-install the Video drivers (Control Panel, Programs and Features), then re-install the ATI drivers, choosing the Advanced installation. Uncheck the hotkey options (I have not tested these steps - TRW).

Optionally, disable an existing ATI Hotkey Poller Service with these steps:

1. Start, Run, "Services.msc"
2. In the Services (local) list, locate Ati Hotkey Poller
3. Double click the Ati Hotkey Poller service
4. Change the Startup dropdown menu from Automatic to "Disabled"
5. Click OK, reboot

Disabling this service will not cause any problems. Others have reported that ATI can accidentally have two copies of ATI2EVXX.exe running -- and this is bad. De-install and re-install should fix this problem.

NVidia cards also have a hotkey process that is causing known keyboard problems. As with the ATI drivers, un-install and re-install NVidia drivers, and choose custom installation. When installing the drivers, install only the base video drivers (Update: 2010.08: NVidia acknowledged a keyboard/response problem with their drivers. Download newer NVidia drivers to resolve this issue.


7. Dell Media Direct

Dell Media direct (Cyberlink Corp; service: PCMService) is a program distributed with many Dell desktop and laptop computers. Custom buttons on the laptop's keyboard (or on a desktop's keyboard) enable various multi-media features. All of these features are available via other mechanisms and this program should be removed.

To diagnose this, look in Task Manager for PCMService or in Control Panel, "Programs and Features (add-remove), look for MediaDirect. Consider uninstalling the program - or at the very least, disable the PCMService (Start, run "MSCONFIG.EXE", Services Tab). This disables the multi-media buttons on those fancy Dell keyboards -- but who uses them?

Additional comments: Several have reported this was definitely a problem on their computers.


8. Virus and Spyware Problems


If your computer is infected with a lot of spyware, all operations will be sluggish -- but you would already know about this problem. See these Keyliner articles for removal steps that work with most programs: Removing Viruses and Fixing Slow Computers. You may also have a virus/key-logger installed.


9. Video Drivers

Although not as likely as the options above, slow video drivers can also cause slow scrolling if the screen cannot refresh fast enough.

Often, Windows 7 does not detect the video hardware properly on install. Symptoms: a Windows Experience Index (speed test: Control Panel, System, Performance) shows a speed of "1.0" . Your system may need a different driver, depending on which Video Card was installed. Check your system's hardware shipping manifest to see which video card is installed.

In Windows Control Panel, Device Manager, expand the Display Adapter section. If it shows a generic Microsoft driver, install a better version.

The two most common drivers are:
NVidia: NVidia.com Downloads
ATI: ATI Downloads

When downloading vendor drivers, watch for variations - Video-card manufacturers have different drivers for different models and be sure to choose properly between 32 and 64-bit Windows 7.


Related articles and links:
Fixing Slow USB Drives
Windows 7 Streamline Start Menus
Fixing Slow Computers


Thursday, January 14, 2010

Raid Volume Rebuild

How To: Steps to take on a failed RAID-1 array, where one drive appears to have failed. This article assumes you have previously installed an Intel Desktop mirrored RAID array with two disks.

Related Article: Desktop RAID-1 Mirrors - Installation

Note: Many searches arriving at this article are asking this question: "Can you reboot a workstation while the RAID is rebuilding?" The short answer is yes, but the RAID rebuild will start over and the drives are at risk. It is best to leave the computer on. See below for other details.

The other question: "Can I use the computer while the RAID is rebuilding?" Yes, with no restrictions.



When a Desktop's mirrored Raid reports a "degraded" or more commonly a "failed" drive, it sounds like a horrible calamity, when in fact, it is probably a minor event -- but it may still require your attention. In a RAID, the computer has 2 "mirrored" hard drives, where one drive is copy of the other. If either fails, the other will continue operating as-if nothing was wrong. When a RAID fails, one of the drives is out-of-sync, or more rarely, failed.


When a RAID fails, it is seldom a physical failure


Reasons:

Usually an array goes south when there has been a power failure or the operating system has crashed (hence why I had to write this article). Opponents of RAID would say, "see, this is why you shouldn't bother with RAID; half the time it is the problem." I counter by saying with only one disk, the odds of corrupting it are much higher and rebuilding the RAID is easy. When the computer goes down hard, logical damage to the disk is likely.

But almost always there is no physical damage -- usually one of the drives just became "out-of-sync" with the other.

Symptoms:

The Windows System tray shows a failed Raid, with one of several possible messages. For example, an Intel RAID controller, commonly found on almost all desktop computers from the past several years, shows a two-disk drive icon (the mirror), where one is red.

This illustration shows a failed array that is in the process of rebuilding
  • If it shows "Degraded," it is in the process of rebuilding and there is nothing you need to do but wait. I would leave the computer running while it rebuilds. You can still work, open files and surf the net while this is happening.
  • A "Failed" drive requires action on your part; follow the steps outlined in this article.

Steps:

1. In the System Tray (you may need to show hidden icons); choose the RAID icon.

If you do not have this icon, look in the Start Menu "Intel Matrix Storage Manager" or "Intel Rapid Storage Manager." You can confirm the program is installed by looking in the Control Panel's 'Programs and Features' Add-Remove. (Since this article was written, this utility was renamed from "Intel Matrix Storage" to "Intel Rapid Storage Technology; see download link at the end of this article)

2. "Mark the failed drive": Once the panel opens, tunnel down the tree, locating the failed drive.

"Other-mouse-click" and choose "Mark as Normal".

This should start the rebuild. The System Tray icon will show "A RAID volume is being rebuilt. Data redundancy is being restored."

Click the image for a larger view; click right-x to return

3. Watch the progress by opening the Volumes folder (illustration above, locating the Yellow icon). Other-mouse-click and choose "Show Rebuild Progress".

The indicated time is a reasonable estimate and a 1Terabyte drive can take about 1.5hrs to rebuild.


While Rebuilding - Rebooting, etc.:

While the RAID is rebuilding, you can still use the computer as you would normally, but it is best (but not required) that you leave the machine powered on until the rebuild completes. During this time, the computer may behave a little slower and there will be much disk activity.

If you shut-down the computer, the rebuild starts over on the next reboot. If you do power-down the computer, the remaining drive, however unlikely, is at risk for a failure. If power-problems have caused the RAID to fail, be careful about stopping the RAID rebuild prematurely.

Also, if the computer goes to sleep, the rebuild is also suspended. Consider disabling the Screen-savers during the rebuild.


Performance Improvement: Hard Disk Cache

If the RAID is rebuilding too slowly (more than 4 hours), check the local Hard Disk Cache setting.
  • From the Storage Management Console, open the Volumes folder.
  • Other-mouse-click "SysRaid" and choose "Enable Volume Write-Back Cache". This change can be made on the fly.
  • Alternately, this same setting can be found in Control Panel, Disk Drives, locate the hard disk "SysRaid", select Properties, "[x] Enable Write Caching on the Device."

This setting changed my Rebuild from 4 hours to 1.5 hours. This same setting has other benefits and all disk-IO activity will be faster.

Really Long Rebuild Times:

Before looking at these steps, be sure to see the section directly above.
Some readers have reported 80+ hours on a 1Terabyte rebuild. I am waiting on their reply to see if the cache-setting (above) helped the problem and your help in this is welcome.

I would wonder if the machine were infected with Viruses. Consider disconnecting the network cable, then disable the virus scanner and try the rebuild again. If this does not improve the rebuild times, leave the RAID broken while you do a more thorough test for viruses. Consider this Keyliner virus article: Removing Win-Viruses.


More Serious RAID Failures:

Sometimes, rarely, after a particularly brutal power failure, the motherboard may not be able to detect the "failed" drive. In the Matrix-software, you may not see the failed drive.

Try these steps:

a. Power off the computer and disconnect the failed drive. (Use the utility to see the drive's serial-number).

b. Boot the computer, then shut down normally.

c. Re-connect the failed drive and attempt the rebuild again.

(Note: This power-off/disconnect solution has not helped those with 80+ hour rebuilds.)


Re-Occurring Problems:

If the RAID array fails frequently, there could be several causes. Consider the following, where the most common are listed first:
  • Bad power; intermittent power; low-voltage power; get a UPS.
  • A weak PC powersupply (replace/uprgrade to a larger supply)
  • Failing circuitry on the main motherboard (especially if you have been having power problems)
  • An actual drive failure
If the drive has physically failed (note: I have not seen a real failed drive in many years; it seems much rarer than it was in the mid to late 90's), you must replace it with a similar drive with the same capacity (or larger).

The replacement drive does not have to be the same brand and model (although that is my preference, when possible).

RAID is not a Cure-all

Remember, a RAID does not protect you from having to do backups. It will not protect your data if a virus strikes, the computer is stolen, or the house burns down. Here is where an off-site backup is nice to have.

Consider the RAID as insurance against a drive failure (which is admittedly rare). More likely, it is insurance against a corrupted disk due to power-failures and other hard crashes. As I had discovered this week, a power failure caused one drive to depart while the second survived. The RAID saw the problem and still allowed the computer to boot.

This was the behavior I wanted to see during this type of event. I will never know if a single drive would have survived the outage, but I do know all was safe. I simply re-built the RAID and was back to normal a few hours later with nothing more than a few mouse clicks.


Related articles:
Desktop RAID-1 Mirrors - Installation
Acronis vs Ghost
Maxtor External USB


Links:
Intel Download Page (Choose your operating system and computer for best results)

As of 2010.08:
Intel Download: Rapid Storage Technology (SATA ver 9.6.0.1014 2010.03.23 formerly called Intel Storage Manager. Choose the 'AllOS' version, at the bottom)

Sunday, January 3, 2010

Optimizing Windows Paging/Swap File

Optimize Windows 10, 7, Vista and XP's Swap file by following these steps, which results in a slightly faster computer with less disk fragmentation. This is an admittedly geeky thing to do. Article updated for Windows 10.

Contents:
  • Why optimize the Paging File
  • Set Paging File Size to Zero
  • Defragment the Disk
  • Re-allocate Paging File to Fixed Size
  • Recommended Sizes

What is a Swap File?

The "Swap file", also known as a "Paging File" or "Virtual Memory" is used by Windows to extend the PC's memory by simulating (virtualizing) memory on the hard disk. It works like this: As more programs and applications are loaded into memory, you may exceed the amount of physical RAM. When this happens, Windows takes the least-used program and "pages-it" to the hard disk. The paged-out program doesn't know it was moved into Virtual memory and while there, it is in suspended animation.

When you switch back to the application, Windows pulls it from the hard disk's paging file and crams it back into memory, while shoving something else to disk. Paging only happens when you run out of memory and there are too many programs are running at the same time. Although paging is a wonderful idea, it is slow. PCs that constantly dip into the paging file really need more RAM.


By Default, Paging Files Fragment

When Windows is first installed, a paging file is automatically defined, with a minimum and maximum size. With each reboot, Windows re-allocates (re-creates) the file, starting with the minimum size. This can be large -- often 1.5 times physical RAM. In other words, if your PC has 2G of RAM, then the paging file is likely about 2.0 to 3G. With each reboot, the old paging file is destroyed and a new one is constructed

As Windows allocates the new file, it starts writing on the first available disk cluster, but because the file is so large, it invariably runs out of space and the file is fragmented into multiple locations across the hard disk. For most systems, the paging file fragments into hundreds, often thousands of different locations. As the computer dips into virtual memory, the file continues to expand and fragment, up to its maximum size. This causes other files to fragment more often than normal.

Although it is not a true representation of the hard disk, Windows XP Defragmentation screen hints at the Swap file's location. In the illustration, the green, unmovable clusters are likely the swap file. The file fragments across other clusters too small to see in the graphic.  I wish this detail were still available in the new operating systems:




Optimizing the Paging File:

With the steps outlined here, you can force a permanent, fixed-location swap file and you can keep it from allocating and de-allocating. This helps keep other files from fragmenting as much and you will see slightly faster boot times.

Update:  Added Windows 10 steps; see below for Windows 7, along with more details.  The steps are nearly identical.

Windows 10 Instructions:
Illustrated details below, in the Windows 7 section.  Steps are nearly identical.

a)  Launch Windows Explorer
b)  Highlight "This PC / My PC", "other-mouse-click", choosing "Properties"
c)  Select Advanced System Settings
d)  On top-tabs, select Advanced.  Click "Performance"
e)  Click the second "Advanced" tab
f)  Click "Virtual Paging"

Uncheck [ ] Automatic manage paging file size
Set "No paging file"  (Set)
Click OK, OK.  Ignore warnings.
Reboot to de-allocate the file.

g)  After reboot, manually defragment the hard disk:

-  Open File Explorer
-  Highlight drive C:, other-mouse-click, "Properties"
-  In the Tools Tab, click Optimize and defragment drive.
-  Allow defragment to complete.

h)  Return to the Virtual Paging screens, above

i)  Manually set a Virtual Paging Size.  The numbers are not important but for most machines, I pick 1500-1500, or 1800-1800, where both the min/initial and max sizes are the same. Click "Set" to commit.


This fixes the swap file on the disk, making it immovable and permanent.  This file is the number-one cause of fragmentation on your disk.

Windows 7 Instructions:

It is easy to optimize the Swap File but it takes time and a few reboots. Follow these steps, in this order:

Delete the existing Swap file - Set to Zero

1. Open System Properties:

Windows 7
  • Other-mouse-click (right-mouse) "Computer" (e.g. MyComputer)
  • Choose "Properties"
  • "Advanced System Settings"
2. In System Properties, click the [Advanced] tab.
  • Click Performance's "Settings" button

(double-click image for larger view; click "right-x" to return)

3. On the Performance Options screen,
  • Once again click the [Advanced] tab
  • Click the Virtual Memory "Change..." button


4. Inside of the Virtual Memory dialog:
  • [ ] Uncheck "Automatically Manage"
  • Set "No Paging File"

  • Ignore the warning message
  • Click OK and close all dialogs
  • Reboot (you must reboot now)


Defragment the Disk

Once rebooted, defragment the disk. This forces the soon-to-be created new swap file to arrive in a contiguous disk space with minimal fragmentation. Although this step takes time, it involves only a few clicks:

5. In Windows Explorer:
  • "Other-mouse-click" the C: drive .
  • Choose "Properties", then [Tools].
  • Click "Defragment Now".
You only need to defragment the C: drive.
Wait for the defragmentation to complete.

Note: Windows 7 displays a progress-indicator but Vista gives no indication when it will complete. Defragging can easily take an hour or more. With Vista, wait until the "Cancel defragmentation" button changes back to "defragment now" -- then you will know you are done.

Re-Allocate the Swap File

When the disk is defragmented, return to the Virtual Memory dialog box (see above) and re-build the paging file, following these steps.

6. In the Virtual Memory dialog:
  • Set a Custom Size, where both the minimum and maximum sizes are the same.

Recommended Swapfile Size:

Recommended sizes are about 1.5 times your physical memory.
But for reasons explained in a moment, do not exceed 2G (2048) or at most 3G of disk, regardless of how much RAM you have.

For example:
2GB to 4GB RAM, set to 1200, 1200
8GB RAM, set to 1500,1500
16GB RAM, set to 1800,1800

These are not hard-set rules, just recommendations.  If you ever ran out of space, re-do these steps and pick a larger size.  I have never met anyone who has had to do this.


The key to setting the size is to set both the minimum and maximum to the same value --This keeps the file from growing and shrinking (and thus fragmenting).

The actual number chosen is not that important and it does not need to be in the increments above. Once set, ignore any warnings Windows might display, and reboot the computer one last time.


Following the 1.5x Rule:

Contrary to most publications, even if you have a two or more gigabytes of RAM, do not bother setting the swap file much larger than 1.5 to 2G. Larger swap files take even longer to parse and the performance-loss may not be worth the trouble.

Keep in mind, the swap file only has to be large enough to hold the largest swapped-out program and its data -- it does not need to hold the entire memory pool. Besides, at some point, it is useful to actually run out of Swap File space; when you do, Windows displays "out of virtual memory." This is your hint to spend $70 and buy more RAM; when you do, your computer will run faster.

What if you set the swap file to a larger size? No harm done - except you will have a huge file on the hard disk that likely adds no benefits to your system and it will slow down backup programs.

You are now done optimizing the Swap file.


Additional Notes:If you have a separate physical drive, there is some benefit in moving the swap file to a different physical drive, as long as that drive is different than the operating system's disk. Most of the benefit is because fragmentation is minimized, but if you follow the steps above, this is a moot point and for this reason, it is not worth the trouble.

If you do this, be sure the secondary drive is a "real" disk and not a second partition on the same physical drive. Contrary to many reports, placing the swap file on a second partition actually slows the computer down because the read-write head has to jump from partition-to-partition as files are paged. At least with a second physical disk, each read-write-head travels independently.

In any case, if you are dipping into the Swap file you really need more RAM, or at the very least, close some programs.

Updates:
A friend of mine pointed out a Microsoft Systernal program that can defragment the hard disk without going through the trouble to of setting the file to 0-bytes and defragging. On Microsoft's site, search for this phrase: "Systernal PageDefrag". Download and install the utility (I have not looked at this utility with Windows 7 or Vista). With this, you still have to reboot, but an existing page-file can be defragmented. Of course, this is still a moot point if you don't change the min-max size to the same number, as described above.

Related Articles:
Vista Spiffs - For performance
Taming Browser Cookies
Stopping the most annoying Vista UAC Nags
Streamlining the Start Menu
Windows Folder Locations