Swap File Optimization
March 29, 2008
Swap File Optimization
Optimizing your swap file may seem a moot point now, memory prices being that low, still it’s never a bad idea.
How much swap space do you need? That depends the amount of RAM you have and the programs you use. The rule of the thumb is 1.5 times the amount of system memory, unless you have too much memory on your system (make it 1 times or less) or too much load (make it more than you system’s load). Say we decided we must create a swap file of 512MB.
Linux guys have always relied on disk partitions specially designated for the swap. That way, the swap is never fragmented. You can use a similar approach in Windows. If you are doing a fresh install, leave some unpartitioned space in your disk drive to fit the swap file (A little more than 512MB). If your system is already installed, you must use some re-partitioning software like ‘Partition Magic’.
In Windows, you have to create and format the swap partition using the Disk Management settings (Start->Control Panel- >Performance and Maintenance->Administrative Tools->Computer Management->Storage->Disk Management). Be careful because this tool has the ability to destroy your data if you are not careful!
Make sure you create an ‘Extended’ partition in the free disk space and then create a ‘Logical Drive’ inside the extended partition. Apply the changes and then format it. Note that you don’t need to format the swap partition using advanced filesystem types like NTFS or FAT32. FAT16 is quite faster than the other two, and since this partition is only going to host one file, you don’t need to worry about cluster size. Also, the security/fault tolerant features of NTFS are not needed for the swap, unless of course you are running under *real* tight security.
From then on, it’s easy. You have to go to Performance Options (Start->Control Panel->Performance and Maintenance- >Administrative Tools->System->Advanced->Performance->Settings->Advanced->Virtual Memory->Change). Change the values ‘Initial Size’ and ‘Maximum Size’ to the size of your swap (512MB). Note that you have to specify the *same* amount for both values. This will keep your swap file from resizing, fragmenting and eventually slowing itself down.
Another cool trick can be used if you have more than one disks. Provided that both disks are of almost the same speed, in the above dialog you can split the swap file in two or more equally sized partitions (256MB each in our example). This will result in greater swap file performance, since the system will be reading from two disks at the same time. This way you will be actually setting up a raid0-like swap!
Good luck and keep those drives spinning!
Popularity: 24% [?]







































Comments
Got something to say?