Swapfile Optimization Guide
 






Comment #21

Adrian,

Liked the article but you neglected to say anything about moving the swap file to a second SCSI drive. Would there be an access penalty there too?? Can two SCSI devices access data at the same time with no penalty is my question??

Thanks for the great article.

Chris Austin


Hello Chris,

I'm no SCSI expert but from the little bit I know about SCSI, multiple SCSI drives can run concurrently on the same SCSI controller so moving the swapfile to a second SCSI drive won't face the same limitations as an IDE drive. So, it might be better to move the swapfile to the secondary SCSI drive though I'm not sure how much the slower speed of the secondary SCSI drive (if it's slower than the primary SCSI drive) would affect the overall performance of the swapfile.

Adrian Wong
Adrian's Rojak Pot
http://www.rojakpot.com/
http://www.adriansrojakpot.com/


Comment #22

Adrian,

Great article on the swap-file. My question is this: I have 256megs of memory and Win98. I ran your test from system monitor with apps, 2 games (one was Unreal), 3 open web pages, and the TV tuner on. CPU usage stayed constant at 100% with this, but when monitoring the swapfile it stayed at zero. I set a 100mb swapfile just in case, but is that overkill? Since it stays at zero no matter what I thow at it, would I get any benefit from disabling virtual memory and just use physical ram? Would that affect system stability in any way?

Thanks

Joseph Zodda


Thanks Joseph,

Well, it's best to set aside at least some space for the swapfile because some utilities require the availability of a swapfile to function properly. Since you have so much free system RAM, you can reduce the swapfile size to 30-40MB.

Disabling the swapfile won't really improve performance much. The system, by default, uses physical RAM when possible and only uses the swapfile when necessary. As you have noticed, with 256MB of RAM, Win98 didn't need to use the swapfile at all. So, the presence of the swapfile merely serves to provide you with the ability to run some applications that require it to be present.

Removing the swapfile may free up some space at the outer tracks of the hard disk (if it was moved there previously) that can be used to store application data for slightly faster access. Still, I think you should go with at least a small swapfile to ensure that your software will run without any problem.

Adrian Wong
Adrian's Rojak Pot
http://www.rojakpot.com/
http://www.adriansrojakpot.com/


Comment #23

Great article on Swapfiles, and comments too. We need more of this kind of detailed article. I've got some comments here that I'll break into sections.

SCSI:

As one reader pointed out, SCSI has several advantages. Besides multitasking, so all drives can be working at the same time, including the one with the swapfile, there are others:
- SCSI drives offer the highest transfer rates (ie 10000 rpm)
- SCSI drives have at least double the MTBF ratings
- SCSI drives have two to eight times as much onboard cache
- SCSI BUSMASTERING host adapters use less CPU than IDE busmastering
- Of course you can have lots of SCSI devices
- SCSI supports hardware RAID 4 or 5 for even faster performance and fault tolerance, as well as caching conrollers. The only disk bus that's faster at the moment is fiber channel.

Unfortunately, SCSI is more expensive, and in the case of higher RPMs you also get more heat. SCSI controllers are notoriously bad for overclockers as well.

BUSMASTERING will help swap files on both IDE and SCSI drives.

SWAP FILE LOCATION:
The fastest part of any disk is a limited resource with unlimited demands. While putting the swap file there will speed it up, other files may suffer. As you pointed out, programs will load slower as they are moved further from the start. But programs are usually loaded only once per session. For example, once your OS is booted, most of those files are hardly accessed again, if at all.

Databases, on the other hand, are sometimes used non-stop. Moving them further out can be a huge performance hit.

Likewise, moving your FAT further out can be a performance hit. If you are working on something with a lot of files (ie database) and constantly moving them around, a lot of time could be spent updating the FAT.

Some optimization programs used to give you the option of moving the FAT, certain programs, or directories, to that section of the disk, to improve performance of that particular application.

Having more than one disk, on another SCSI or IDE controller, to divide the work between, can help.

PARTITIONS:
A lot of people have made creative use of multiple partitions. This can still work with the swap file on the first partition. For reliability and flexibility, I use the following setup on a 9GB medalist pro:

Partition 1: drive c: 512MB, Win98, primary partition
Partition 2: remainder of drive, extended partition contains:
    Logical drive d: 512MB, WinNT 4.0
    Logical drive e: 7.81GB, Fat32, for apps/games/data
You can fit a Linux data and swap partition into that extended partition too if you want.

What is handy is to make paritition images of your OS using a program like Ghost, Linkwiz, DriveCopy. Back this up onto your data partition, another drive, or even a cd-recordable.

If you're like me, you try out lots of apps, games, demo software, etc. Eventually, the OS gets unstable, and it's time to re-install. Instead, I just restore my image of the OS and drivers back over top the OS partition. Takes about a minute on my system. I'm back up and running with a clean OS.

While I may have to re-install apps that are on the drive e:, I won't lose any data. For many apps, settings will be retained in the app directory, and you may only have to make a shortcut to the icon to run them acain. My three most important apps (Pingtool, Quake 2, Netscape 4.5) are like that. So I'm back up and running with a clean system and the apps I need in record time. A clean system can have just as much effect on performance as the swap file sometimes. This method also helps you deal with pesky MBR problems, or have multiple OS images that you can restore at a moment's notice.

One reader mentioned block sizes having an effect on swap file performance. I know on file servers, this can have a major effect on data transfer rates. But I wonder, for a desktop user, what the performance difference would be for Fat32 vs Fat16 ?

Dennis Gorrie


Hello Dennis,

If I'm not mistaken, Norton Utilities or similar defragmenting utilities will still allow you to manually move any file you wish to the outer tracks of the hard disk. So, you can move the database files to the outer tracks though it may promote fragmentation of the hard disk.

Your creative use of multiple partition is very interesting. It does show that multiple partitions can be useful. Thanks for telling us your experiences with multiple partitions. It's definately a very interesting read for those who have not tried it. However, I'm not too sure if multiple partitions are useful at all in safeguarding data because I have always lost everything on the hard disk when the first partition was corrupted / destroyed. In addition, Symantec concurred with the statement that if the first partition is taken out, most likely the whole drive (other partitions) is lost.

There should be a small performance degradation when using FAT32 over FAT16 due to the added overhead. But FAT32 has many other advantages that more than makes up for the added overhead. Taken directly from Symantec, "Since FAT32 drives use a smaller cluster size, typically FAT32 drives have less wasted (slack) space on the drive. In addition, FAT32 systems can relocate the root directory and use the backup copy of the FAT instead of the default copy. Also, the boot record on FAT32 drives now backs up critical data, meaning FAT32 drives are less likely to fail. Since the root directory on a FAT32 drive is a cluster chain (instead of being a physical area on the disk), it can contain more entries than a FAT16 drive (up to 65,536) and it can be located anywhere on the drive."

Adrian Wong
Adrian's Rojak Pot
http://www.rojakpot.com/
http://www.adriansrojakpot.com/


Comment #24

I recently downloaded this program called cacheman and its supposedly tunes your vcache or whatever to optimal settings, but i have a feeling that this thing maybe slows down my computer. I can't really explain how the features work or do, cuz i don't really understand them but the program is here - http://members.xoom.com/ultimatum/download.htm and download the latest cacheman.

Thanks, the article was great

Danny Chang


Hello Danny,

If I'm not mistaken, all CacheMan does is provide a GUI front for modifying these settings in the System.Ini file :-

[vcache]
MinFileCache=xxxxx
MaxFileCache=yyyyy
ChunkSize=zzz

I don't think it will do anything more for you than what manually modifying those settings yourself will.

Adrian Wong
Adrian's Rojak Pot
http://www.rojakpot.com/
http://www.adriansrojakpot.com/


Comment #25

Hi,

I liked your article about the optimization of the Swapfile. A lot of people are speaking about Vcache settings and the influence on the performance. I just want to mention IMHO the best program I found for changing this (and other) settings on an easy way.

The programs name : cacheman; and it's postcardware. The link to the homepage of the author is : http://members.xoom.com/ultimatum/cacheman.htm

I really think it's worth downloading it and give it a try and make comparisions with different settings.

Johan Van Driessche


Thanks Johan,

As I have mentioned to Danny Chang above, all CacheMan does (if I'm not mistaken) is change those settings in the System.Ini file (under the [vcache] section). It is definately an easy way to change the vcache settings though I'm not so sure the values are optimal. Testing various vcache settings is definately one of the things I intend to do one day.

Adrian Wong
Adrian's Rojak Pot
http://www.rojakpot.com/
http://www.adriansrojakpot.com/


Comment #26

Hi, I found your swapfile optimization extremely insightful and well written. It's amazing the stuff you've put down, it's simple and straightforward and doesn't leave any grey areas!!

I'm just curious but is there a newsgroup that discuses this kind of hardward optimization stuff?

Until then......

Victor Ho


Thanks, Victor,

Unfortunately, I have no idea which newsgroup is best for such discussions. But you might want to try our forums. Lots of optimization experts reside there. :)

Adrian Wong
Adrian's Rojak Pot
http://www.rojakpot.com/
http://www.adriansrojakpot.com/


Comment #27

As someone else mentioned on your swapfile optimization comments page, SCSI does benefit from being able to access ALL SCSI devices simultaneously. And as a matter of fact it has been a long-known optimization tip for NT'ers to move their pagefile (swapfile) to the 2nd SCSI harddisk exactly for this reason. The system/boot drive can be doing its thing while the pagefile/and-whatever-else drive is doing its. I have both an UltraWideSCSI 7200rpm Seagate HD and an UltraSCSI Plextor 32x CD-ROM. Audio extraction FLIES by at over 20x thanks to direct device-to-device simultaneous communication!!

And as far as IDE being less CPU intensive, this is simply not true when done properly. SCSI benefits from having an embedded/dedicated processor for disk I/O (the SCSI host controller). Whereas IDE uses the CPU as its host controller. DMA mode on the new UltraDMA drives has done wonders to fix this problems but even the best UltraDMA setup does not match up against a good SCSI setup. I think I know which IDE vs. SCSI comparison you read. It was the Quantum HD article right? One thing to keep in mind is Quantum is not a "well respected" SCSI HD manufacturer. For this you need to stick to the "big boys", Seagate, IBM and Micropolis (who unfortunately were bought out). Typical UltraWide SCSI systems will see under-4% CPU-utilization at 8MB/s transfer rate. Even up to 15MB/s wouldn't go much over 7%, and keep in mind this is REAL WORLD numbers not benchmarks or theoretical transfer rates. Typical pre-UltraDMA HDs would see 15% to 40% CPU utilization at a measly 3MB/s to 5MB/s.

I couldn't agree more with your comments about the 2.5x rule for swapfiles. That is ridiculously outdated, it's amazing people still follow (and quote!!) that rule. I keep a 128MB permanent swapfile to go with my 256MB of RAM. Of course I'm still up in the air about how to set my VCACHE. Any ideas?

Also, one more comment, on your RIVA TNT optimization page you state this:

"The RIVA TNT is currently the world's fastest 2D/3D graphics processor. Boasting an official fillrate of 180MPixels/s and a 36 billion operations/s pixel engine..."

That is a misleading statement. From a fillrate perspective, sure. But the TNT, like all gamer 3D cards, is humbled by even a cut-rate professional 2D/3D card (for example the Permedia2) when it comes to polygon (triangle, vertex, geometry, whatever you want to call it) counts. That is because the TNT, again like all game3D cards, does not have an on-board geometry setup engine, instead relying on the CPU. Compare the TNT for one second against a 3Dlabs Oxygen GMX (or the lower-priced Oxygen RPM) in a professional 3D environment (IDEAS, ProEngineer, AutoCAD, 3D Studio, etc.) and it is instantly obvious how weak the TNT really is. That is the reason I own both a Permedia2 (FireGL 1000 Pro) and a Voodoo (Canopus Pure3D), one for AutoCAD/3D Studio the other for games. I'm also considering trading my FireGL in for an Oxygen RPM (the question is, is it worth the additional $800 I'd have to pay?)

Gary Mulhern


Hello Gary,

Wow!! That's incredible! CD audio extraction reaches a maximum of only 10X with my IDE IBM 14GXP hard disk and 40X Asus CD-ROM.

Err... I don't believe I stated that IDE is less CPU intensive than SCSI. That's not true as far as I know. But with bus mastering drivers, IDE subsystems will bypass the CPU and use the motherboard chipset to handle IDE transactions, leaving the CPU free to do other work. From the tests I have done, the IBM 14GXP hard disk has a 8.79% CPU utilization with a 4MB transfer rate and 13.1% CPU utilization at the maximum transfer rate of 13MB/s. So, SCSI definately still wins the CPU utilization war.

Several users who was advocating the use of the 2.5X rule in Anandtech's BBS was what got me started on this article. I had previously though that the 2.5X rule had died a natural death. Unfortunately, it appears that many are still adhering to it. Actually, I'm now not really sure what's optimal for vcache in Win98. I'll have to run some tests to check the various vcache settings out.

Oops! I meant that the RIVA TNT is the fastest gaming 2D/3D graphics processor actually. I agree that even the RIVA TNT cannot match the Permedia 2 in professional 3D applications. My friend, Ken Ng, owns a Permedia 2 (FireGL 1000 Pro as well) and after he tested the RIVA TNT earlier, he told me that the Permedia 2 still rules in rendering his 3D Studio Max pictures. Definately not a gamer's card, the Permedia 2, but it sure pulls its own weight in a professional 3D environment. On the other hand, the latest nVidia Detonator drivers supposedly corrects the RIVA TNT's poor performance in professional 3D applications. The RIVA TNT could possibly match the Permedia 2 if paired with a fast CPU.

Adrian Wong
Adrian's Rojak Pot
http://www.rojakpot.com/
http://www.adriansrojakpot.com/


Comment #28

Nice article on the swapfile. I have one additional tweak for those who do not have a commercial defrag: Create the first drive on the hard disk as a swapfile drive (~200 MB, but don't fill it up with the swapfile). This will keep your swapfile on the outer part of the disk and allow for easier multi-booting of different OSes (if you're into that sort of thing).

Te7k


Thanks Te7k,

Just remember that this method will deprive application storage of some outer track space for faster loading time. I think it's certainly a viable alternative for those who do not want a permanent swapfile / can't afford a commercial defragmentation utility like Norton Utilities and don't mind sacrificing some space for the swapfile partition. But try Jeff Viken's idea first.

Adrian Wong
Adrian's Rojak Pot
http://www.rojakpot.com/
http://www.adriansrojakpot.com/


Comment #29

Think your article on the swap file is great! I'm a somewhat self-taught tinkerer & I was told that I need to run 4x my ram by someone a while back. Knew that didn't seem right since the more ram you have, the more space you'd use. Glad to see you put it up in print.

Do have a question or two. While looking at your site w/ Netscape 4.5, clean sweep 4.0 in the startup menu, ACDsee viewing some pictures, then running a Mpg with media player, after all that the system monitor said I only used a max of 14 megs of swap file. Can that be right?!?!  Running Win98 w/ 32 megs of ram & I try to keep things simple, but that would be a 50mb swap file by your figures. Seems awful small. Also what is Vcache exactly? I'm a newbie & have never come across it before.

Great Site!

Jeremiah Westpfahl


Thanks Jeremiah,

Well, the memory use of each system is different and depends on what's loaded and what's not. That's why it's best to check your system's use of memory and the swapfile using System Monitor rather than relying on information from other people.

Virtual cache (vcache) works like the old DOS Smartdrive. It caches hard disk data using a portion of the much faster system RAM so that frequently accessed hard disk data can be retrieved much faster than would have been the case had the data was taken directly from the hard disk again. So, you can say that vcache is to the hard disk what the L2 cache is to RAM.

Adrian Wong
Adrian's Rojak Pot
http://www.rojakpot.com/
http://www.adriansrojakpot.com/


Comment #30

Like the page about the pagefile.

My system:

IDE Interface1:
IDE drive 1 = 2GB (2gb FAT16) (Dos6.22 put here)
IDE drive 2 = 1.3GB (1.3GB NTFS) (WinNT put here)

IDE Interface2:
IDE drive 3 = 2.5GB (1GB FAT16, 1.5GB NTFS)
IDE drive 4 = 10.1 GB (10.1 NTFS)

Scsi-CD

Paging file (swapfile) put on the 2.5GB drive on the first (FAT16)  partition. The main program used on the machine is 3D Studio Max, and pretty big projects. It does need a HUGE swapfile (128meg ram).

The best configuration? Can I do better?

Ulf Hallberg


Well Ulf,

I can't really tell you much since you are using a WinNT system. But I would think using the 10.1GB hard disk as a primary hard disk (IDE drive 1) would be a good idea. Also, if the 2.5GB hard disk isn't too slow, you can place the swapfile there (IDE drive 3). Thus, with both hard disks on separate IDE controllers, you can access data on the primary hard disk (IDE drive 1) and the swapfile on the IDE drive 3 concurrently.

But if the 2.5GB hard disk is much slower than the 10.1GB hard disk, it might be better to place the swapfile on the 10.1GB hard disk itself. Just remember to create a permanent swapfile and move it to the outer tracks of the hard disk for better performance.

Adrian Wong
Adrian's Rojak Pot
http://www.rojakpot.com/
http://www.adriansrojakpot.com/

Comments?

If you have a comment or two about this article, please post them here.

Thanks for your time and I hope you enjoyed the article! :)

 

 
 

 

 
     
   

 

 
   

 
     
 

                   

 
   

 

 
 
Last Updated 16-10-2000

All trademarks used are properties of their respective owners.
Copyright © 1998-2000 Adrian Wong. All rights reserved.

 
Visit the new Tech ARP @ http://www.techarp.com/ !