DESKTOP

Windows Vista : Performance - Hard Disk (part 2) - Optimize Virtual Memory and Cache Settings

8/28/2012 1:26:18 AM

2. If in Doubt, Throw It Out

Parkinson's law states that work expands so as to fill the time available for its completion. Along the same lines, it's safe to say that files will quickly expand to fill the amount of available space on your hard drive.

Low disk space doesn't just make it harder to store files; without ample room for virtual memory (discussed later) and temporary files, Windows will slow to a crawl. Less free disk space also increases file fragmentation as Windows scrambles to find places to put data; this in turn also lowers performance. Keeping a healthy amount of free disk space is vital to a well-performing system.

Additionally, removing drivers and applications that are no longer used clears more memory and processor cycles for your other applications, which can substantially improve overall system performance.

If your PC is low on disk space, try NTFS compression.Right-click any folder, select Properties, click Advanced, and turn on the Compress contents to save disk space option. Note that this can degrade performance, so you'd be wise to use it only for data that you don't access or modify often.



Even before you install your first application, your hard disk is littered with files from the Windows installation that you most likely don't need. The standard installation of Windows Vista Ultimate Edition places more than 39,000 files, consuming more than two gigabytes of disk space, on your PC.

Whether you need a particular file can be subjective; some might consider the 11 MB of .wav files that Vista puts in your C:\Windows\Media folder to be excessive, while others may scoff at the notion of worrying about such a piddly quantity. (To put things in perspective, this is about the same size as three photos from a 10-megapixel digital camera. It's also slightly more than the total capacity of my first hard disk back in 1983.)

Naturally, it makes sense to be cautious when removing any files from your system. The removal of certain files can cause some applications, or even Windows itself, to stop functioning. It's always good practice to move any questionable files to a metaphorical purgatory folder before committing to their disposal. And I don't have to tell you that backing up your entire hard disk  before you clean house is very important and not all that difficult.

The easiest way to delete the stuff Windows considers expendable is to run the Disk Cleanup tool (cleanmgr.exe), discussed in the "Disable Disk Cleanup" sidebar.

Disable Disk Cleanup

When your PC starts running out of disk space, Windows will prompt you to run the Disk Cleanup Wizard, which presents a list of some of the files you can delete to recover free disk space .

The disable this annoying warning, open the Registry Editor  and expand the branches to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer. If it's not already there, create a new DWORD value (go to Edit → New → DWORD value) called NoLowDiskSpaceChecks. Double-click the new value and type 1 for its data. Close the Registry Editor when you're done; the change will take effect immediately.


2.1. If in doubt

Before you delete any questionable file, there are several things you can do to get a better idea of what the file contains:


Why not open it?.

Start by double-clicking a suspicious file to open it in its default application. If you then see the Open With dialog box, it means the specific filename extension has not yet been registered. In that case, your best bet is to drag-drop the file into an open Notepad window.


Investigate.

Right-click the file, and select Properties. If the file has a Version tab, it's likely an application, driver, DLL, or other support file. Choose the Version tab to view the manufacturer, copyright date, and possibly the application it accompanies.


Hide it first.

If you're not sure if something should be deleted but want to try anyway, move it to another directory first to see whether everything works without it for a week or so. If all is clear, toss it.


Check the date.

Check the file's Last Accessed date (right-click it and select Properties). The more recent the date, the more likely it's still being used. For information on removing a particular application, contact the manufacturer of that application or refer to the application's documentation.


Windows' System Restore feature can consume up to 15% of the total capacity of your hard disk for restore points and shadow copies. 


3. Optimize Virtual Memory and Cache Settings

One of the most frustrating and irritating things about Windows is the way that it can seize up for several seconds with seemingly random, pointless disk activity. One of the causes of this behavior is the way Windows handles disk virtual memory by default.

Normally, Windows loads drivers and applications into memory until it's full, and then starts to use part of your hard disk to "swap" out information, freeing up more memory for higher-priority tasks. The file that Windows uses for this type of "virtual memory" is the paging file (a.k.a. swap file), pagefile.sys, and it is stored in the root folder of your Windows drive.

Because your hard disk is so much slower than your physical memory, the more swapping Windows has to do, the slower your computer gets. This is why adding more memory speeds up your PC: it reduces Windows' appetite for virtual memory. But regardless of the amount of installed physical memory in your system, there are always things you can do to improve virtual memory performance.

Windows' defaults here are rather conservative and can fortunately be modified for better performance. It's important to realize, though, that some experimentation may be required to achieve the best configuration for your setup. Different hardware, software, and work habits require different settings; those with ample hard disks, for instance, can afford to devote more disk space to virtual memory, while others may simply wish to use this procedure to place a cap on the disk space Windows is allowed to consume.

3.1. Part 1: Virtual memory settings

One of the reasons the default settings yield such poor performance is that the swap file grows and shrinks with use, quickly becoming very fragmented . The first step is to eliminate this problem by setting a constant swap-file size.

Note that making the swap file constant will also result in a more constant amount of free disk space. If your hard disk is getting full, consider this solution to restrict Windows from using up every last bit of free space. (Or better yet, upgrade your hard disk.)

  1. In Control Panel, open the System page and click the Advanced system settings link (or run SystemPropertiesAdvanced.exe).

  2. Under the Advanced tab, click the Settings button in the Performance section.

  3. On the Performance Options page, choose the Advanced tab, and then click Change to open the Virtual Memory window shown in Figure 5.

    Figure 5. Change the way Windows handles virtual memory to improve overall system performance

  4. The virtual memory settings are set for each drive in your system independently. If you have only one drive, virtual memory will already be enabled for that drive. If you have more than one drive or partition, virtual memory will be enabled only on the Windows drive by default. Start by selecting the drive that currently holds your paging file (shown in the righthand column) from the Paging file size for each drive list.

    Another way to stop Windows from using the hard disk so heavily is to disable virtual memory altogether, but the consequence of short-changing Windows of its resources will easily outweigh any performance gains. A better choice is to move the swap file to a different physical drive than the one on which Windows resides; that way, when Vista accesses virtual memory, it won't suck the life out of your primary drive.


  5. To set a constant size for your virtual memory, select Custom size, and then type the same value for both Initial size and Maximum size.

    The size, specified in megabytes, is up to you. If you have the space, it's usually a good idea to allocate two to three times the amount of installed RAM (e.g., 4,096–6,144 MB of virtual memory for 2 GB of physical memory), but you may wish to experiment with different sizes for the one that works best for you.

    Important: after you've made a change for any drive, click Set to commit the change before moving on to another drive or clicking OK.

  6. Press OK on each of the three open dialogs.

If you have only resized your swap file, the change will take effect immediately. But if you've added (or removed) a swap file on any drive, you'll need to restart Windows before it uses your new settings.

3.2. Part 2: Defragment the paging file

The steps in the previous section eliminate the possibility of your swap file becoming fragmented, but they won't cure an already fragmented one. You'll need to defragment your virtual memory for the best performance, but the good news is that you only need to do it once if you have a constant-size paging file.

There are several ways to defragment your swap file:


Use PerfectDisk.

Use an advanced defragmenter like PerfectDisk. Just instruct it to defragment your system files, and it will schedule a defragmentation for the next time you start Windows.


Use another drive temporarily.

If you have more than one partition or hard disk in your system, start by moving your swap file to a different drive letter, as described in the previous section. Then, use the command-line Disk Defragmenter to perform a thorough defragment of your Windows drive, or whatever drive you'd like to use for virtual memory, by typing:

defrag -w -f c:

and pressing Enter. Again. When it's done, move the swap file to its new home, where it will rest nicely in the newly allocated contiguous block of free space.


Turn off virtual memory temporarily.

If you don't have a second drive, your other choice is to disable virtual memory altogether by clicking No paging file and then Set in the Virtual Memory window (see Figure 5-12, earlier). After restarting Windows, run Disk Defragmenter as described previously to set aside a large chunk of contiguous free space. When you're done, go back to the Virtual Memory window, and re-enable the paging file, making sure to set a constant size.


Clear the paging file automatically.

See Part 3, next, for another way to reduce fragmentation in your paging file.

3.3. Part 3: Clear the paging file on shutdown

It's possible to have Windows delete your paging file each time you shut down Windows. You may want to do this if you have a multiboot system , wherein each operating system on your PC has its own virtual memory settings. If the paging file from one OS is present while the other is running, it may cause a conflict and will certainly waste a lot of disk space.

If your paging file becomes corrupted or highly fragmented, Windows may load more slowly (or not at all). Deleting the paging file automatically forces Windows to recreate it each time it starts, which may alleviate this problem. (Naturally, if you've gone to the steps to defragment your paging file, as described earlier in this topic, you probably won't want to use this feature, lest it become fragmented again when it's recreated.)

  1. Open the Local Security Policy console (secpol.msc). 

  2. Expand the Local Policies branch and click the Security Options folder.

  3. In the right pane, double-click the Shutdown: Clear virtual memory pagefile.

  4. Select Enabled and then click OK. You'll need to restart Windows for the change to take effect.

3.4. Part 4: Advanced settings for the adventurous

Like virtual memory settings, disk cache settings in Windows Vista aren't necessarily optimized for the best performance, but rather for the best compromise between performance and compatibility with older PCs.

You'll probably need to experiment with different values until you find the ones that work best for your system. Since it's possible to render Windows inoperable with incorrect settings here, you'll want to back up your PC before you begin.


Start by opening the Registry Editor , and expanding the branches to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management. Some of the more interesting values in this key include the following:


DisablePagingExecutive

Values: 0 = disabled (default), 1 = enabled.

Enabling this setting will prevent Windows from paging certain system processes to disk, which effectively will keep more of the operating system in the faster physical memory, in turn making Windows much more responsive.


LargeSystemCache

Values: 0 = standard (default), 1 = large.

By default, Windows uses only 8 MB of memory for the filesystem cache. Enabling this option will allow Windows to use all but 4 MB of your computer's memory for the filesystem cache. This will improve Windows' performance, but potentially at the expense of the performance of some of your more memory-intensive applications.

This option can also be changed by opening the System page in Control Panel: click the Advanced system settings link, click Settings in the Performance section, and then choose the Advanced tab. The Memory usage section has two settings: Programs and System cache, which correspond to the 0 and 1 values here.

Other values in this key include PagingFiles, which is more easily set in the Virtual Memory window described in "Section 5.3.3.1" and ClearPageFileAtShutdown, more easily set in the Local Security Settings console, as described in "Section 5.3.3.3."

Other  
  •  Gaming Mouse Tt ESPOTRS Theron And Mouse Pad Ladon
  •  Windows Server 2008 and Windows Vista : Architectural Parts of a GPO (part 2) - Group Policy Container
  •  Windows Server 2008 and Windows Vista : Architectural Parts of a GPO (part 1) - Group Policy Template
  •  Windows Server 2003 : Server Clustering (part 4) - Using the Cluster Application Wizard, Configuring Failover and Failback
  •  Windows Server 2003 : Server Clustering (part 3) - Creating a New Cluster Group, Adding a Resource to a Group
  •  Windows Server 2003 : Server Clustering (part 2) - Creating a True Server Cluster, Adding a Node to an Existing Cluster
  •  Windows Server 2003 : Server Clustering (part 1) - Cluster Terminology, Types of Resources, lanning a Cluster Setup
  •  Windows XP : Participating in Internet Newsgroups - Downloading Messages
  •  Windows XP : Participating in Internet Newsgroups - Working with Newsgroups in Outlook Express
  •  Analysis Ultrabooks
  •  Farewell To Pixels : Retina MacBook Pro brings the new age of dot-free displays to OS X
  •  Computing – OS
  •  Windows Server 2003 : Protecting Network Communications with Internet Protocol Security - IPSec Basics (part 2) - Differences Between AH and ESP, Process and Procedure
  •  Windows Server 2003 : Protecting Network Communications with Internet Protocol Security - IPSec Basics (part 1) - Security Advantages of IPSec
  •  Windows Vista : Communicating with Windows Mail - Handling Incoming Messages (part 2) - Customizing the Message Columns, Setting Read Options
  •  Windows Vista : Communicating with Windows Mail - Handling Incoming Messages (part 1) - Processing Messages
  •  Windows Vista : Communicating with Windows Mail - Setting Up Mail Accounts
  •  Ultra-X P.H.D PCI2 - Solve PC Problems Easily (Part 2)
  •  Ultra-X P.H.D PCI2 - Solve PC Problems Easily (Part 1)
  •  Confessions Of An Internet Troll (Part 2)
  •  
    Top 10
    Canon PowerShot G15 12MP Digital Camera With 3-Inch LCD
    3D Printed Guns
    Dual-channel DDR3 RAM (Part 4)
    Dual-channel DDR3 RAM (Part 3)
    Dual-channel DDR3 RAM (Part 2)
    Dual-channel DDR3 RAM (Part 1)
    In-Win G7 Black Windowed Mid-Tower Case
    Starcraft II Gaming Mouse & Marauder Starcarft II Gaming Keyboard
    The Computers That Came In From The Cold (Part 2)
    Joystick Junkies - The Sim Hardware Roundup (Part 3) : Thrustmaster HOTAS Warthog, Thrustemaster TH8 RS Gear Shifter, ButtKicker Gamer 2
    Most View
    Corsair 16GB Dominator Platinum DDR3 - 2400
    SQL Server 2005 Native XML Web Services : Example Native XML Web Services Project (part 3) - Creating the Client Application
    Gigabyte U2442 V2 Ultrabook Review (Part 2)
    Turn Your Smartphone Into A Safe
    Group Test: Integrated Valve Amps $2,175-$3,000 (Part 4)
    iOS In The Studio
    Web Design: Where To Start (Part 5)
    Systems for All Budgets (Part 3) - WS 1000, Silent 1000
    Which Components Have Hit The Sweet Spot? (Part 3)
    The Best Bluetooth Keyboards (Part 2)