Swapfile Optimization Guide
 






Comment #1

Hello Adrian,

Nice article, was it the clean memory tool which inspired you to it?

I was wondering if there are any shareware or freeware progs out there which allow the movement of a permanent swapfile to faster partitions / parts of the drive.

Bye,

Armin Hartinger
http://www.PCTechware.com


Well Armin,

If you are referring to what Ashley said about the way Memory Recovery works, then you are partly correct. But it was also because I saw so much interest in it in the various BBSes and forums.

I'm not sure if Win98's Disk Defragmenter does the same thing but I'll try to get someone to test it out and I'll post an update here.

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


Comment #2

This article is pretty good, a few suggestions,

How about those of us with don't have a commercial disk defragger?

I follow this method

  1. Select no Virtual Memory
  2. Reboot
  3. Defrag hard disk
  4. Select permanent swap file.
  5. Reboot.

Now, this won't put the swap file on the outer tracks, but at least it won't be fragmented.

One more thing.... 12 pages? I could see 7 or 8 but 12? That is a lot of clicking and waiting for the rest of your article to come up.

Bill Farmer


Hello Bill,

You are right. I forgot about those without a commercial disk defragmenter. I'm not sure if Win95/98's Disk Defragmenter will move the swapfile to the outer edges of the hard disk because I do not use it. Disk Defragmenter takes way too long to defrag a drive compared to the commercial defragmenters.

Your method of creating a contiguous permanent swapfile is correct. In fact, I can't think of another method! :) I, too, have been using this method in the bad old days when I couldn't afford a commercial disk defragmenter like Norton Speed Disk.

Well, I was actually shooting for 6 pages but it became 11 pages because each of those 6 pages were way too long. I mean, I personally don't like scrolling down a long, long page and I believe most people would consider a long page intimidating. It's something my teacher told me once. That's why I cut them into manageable pieces.

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


Comment #3

Best dang article i've ever seen on swap files (by far!). Nice!

I have a 14.4-gig IBM Deskstar - 7200 rpm deal. I have put the swap file (128-megs, min/max) at the beginning of the E drive.

I have partitoned as so:

C: 2GB for O/S and hardware-related stuff
D: 4GB for Apps
E: 6GB for Games
F: 2GB for drivers, downloads and back-up files.

The theory (as i understood it) was that since the E drive was *halfway* into the drive, on the average, it would take less access/travel time to get to there. In other words, if I'm doing something on E or F, and the heads need to read from the C drive (swap file), they wouldn't have as far to go/travel. Is this flawed reasoning?

Your method seems to suggest that I should move that sucker to the beginning of the C drive, no?

Also, I just upgraded my system fro 128 to 192 MB RAM. (i added another 64-meg stick.) But i am having a heck of a time getting Windows to *use* that extra RAM. If i shrink the swap file size, i get warnings from Norton about low virtual memory, and GDI resources, etc.

Like right now for example, Norton says i am using about 80 MB virtual memory, but i have over 70 megs of physical memory/ram available/free.

I would *greatly* like to see an article on how to put that extra ram to use.

I have already set my vcache to 24-megs min/max (24576 i think was the exact number).

Advice?

Joe (aka Radboy)


Hello Joe,

I think you got it all wrong. The seeks that affect the swapfile are those that are done to access the swapfile clusters that are scattered all over the hard disk. Seeking the swapfile once to access it is an overhead that happens to everyone but needlessly seeking the various scattered swapfile clusters is an avoidable problem. You avoid it by creating a contiguous swapfile.

Putting your swapfile halfway into the hard disk means (as I have mentioned in the guide already) a lower throughput and thus, a slower swapfile. Without a doubt, the swapfile performs best in the first partition of the hard disk.

The problem with the extra RAM is unless you are using it to do memory intensive operations like rendering a 1024x768 3D picture, system resources will prevent you from using it to multitask too many applications at once. Increasing the VCACHE size (but not giving it full rein) is a good way of making use of the extra RAM but after a certain point in size, the benefits of a large VCACHE is less evident.

You needn't worry about making use of the RAM. 3D games will definately make full use of it by caching texture maps while 3D Studio Max will run happier with so much RAM. Needless to say, manipulating several massive pictures with Photoshop will be smoother with more RAM and so on and so forth. As they say, provide it and they will use it.

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


Thanks for the get-back, Adrian.

At the risk of sounding like a complete idiot (me), r u saying i should move my swap file (contiguous) to the very beginning of the C drive (for best pef)? i dunno why i am having trouble accepting this. Is that where u have set *your* swap file?

I understand that the beginning of the C drive is where u have the faster *throughput*, but if the heads are in the E-drive partition, isn't it a fact that they'll take a longer to access the swap file, if it were on the C drive, rather than on the E drive? (i.e. longer distant to travel to get there)

I realize *yer* the expect here ... my wife tells me that sometimes i come off as argumentative - even though i don't *try* to. i don't wanna sound argu-. :-)

What would u set yer swap file size to, if u had 192 MB?

i've been getting some "GDI resources low" warnings from Norton lately (when opening lotsa windows/proggies/apps). Do u know how/if i can allocate more resources to GDI, so i don't get those annoying warnings?? (It's not like I'm hurting for RAM.)

Appreciate yer input, Sir.

One more thing. I heard that *some* laptops (Toshiba maybe?) need that first piece of the C (boot) drive for the O/S, and have probs if u stick the swap file there. u heard this?

Joe (aka Radboy)


Hello Joe,

That was pretty fast. :)

Well, moving the swapfile to the outer tracks (beginning of the drive) is definately the best way to get optimal performance.

The time taken for the head to seek from the D or F partition to the C partition may be slightly longer than the time taken to seek to the E partition (where the swapfile is) but the extra throughput from placing the swapfile on the outer tracks more than makes up for the slight loss. Remember, the head only needs to seek once to the swapfile. That will incur maybe an extra seek time of 3-4ms at most but the gain in throughput can be in the region of over 2MB/s!

Actually, currently, with 128MB of RAM and 2MB min/8MB max dedicated to the VCACHE, I don't need to use the swapfile at all. But I create a small one just in case something massively memory-intensive comes up. With 192MB of RAM, I don't think you'll need any virtual memory. You can disable the swapfile if you want but there are reports that some games will refuse to run without a swapfile.

The GDI resource is one of the system resources I mentioned in the guide that's preventing us from using up our memory. Unfortunately, there's no way to increase it. The only way to regain these resources back is to close the application and reopen it or to log off Windows 95/98 and log back in.

About the laptop, I don't think there's any problem with the swapfile being on the same drive with the OS. In fact, Windows 95/98, by default, places the swapfile there. My friend is currently running his laptop with the swapfile in the first partition. No problems there.

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

P.S. No sirs, please :)


Hey Adrian,

I moved the swap file, and made it smaller, as per yer suggestion. But about the only thing giving me probs with the small Swap File is Norton. I tried to defrag my E drive (6GB partition) and Norton told me "You Ain't Got Enough Memory Boy", also told me i should close up some programs - and then it closed itself. But i didn't have anything open. Just the Speed Disk defragger. u ever run into anything like this?

I noticed Netscape takes the biggest chuck of VirMem space. I have it set to 10 Megs (disk cache). May turn it down. MS Word takes a little took. (1.5 MB) GameSpy. Many take none.

So i increase SW size to 32 and was able to defrag E okay. Haven't tried running any games yet.

Any suggestions?

Joe (aka Radboy)


Hello Joe,

I think Maiora in one of the posts in Anandtech mentioned that such utilities often require a swapfile of a certain size in order to store data while defragmenting the hard disk. This is a precaution in case the power cuts off. If the defragmentation's temporary data resides in volatile memory instead of involatile memory in the swapfile, then everything could be lost if the power goes down. That's why a swapfile of a certain size is required.

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


Comment #4

Nice article by the way.

You should however state blatantly at the end that the best way to increase performance is have enough RAM. I have 192MB of RAM and I have my swap file set to 64MB just in case. You should state as well in your section about using more than one drive that SCSI fixes all those problems.

In fact, SCSI is our god, we should all worship the SCSI. I was just wondering if you have done any actual benchmarks that test your memory subsystems that would prove any of the methods decribed to be more efficient than any other.

Also, would it not help to put your swap file between your OS and your programs. The head seek times are mostly the big delay in a hard drive's operation and to have the stroke on the seek lowered would increase the seek time slightly. I just defragged right after I installed 98' and set my swapfile there and there it stays.

Thanks for your time, I hope I didn't bother you too much, once again great article.

Williams


Thanks Williams,

Actually increasing RAM will not increase performance. It will only help the system perform more efficiently by not using the swapfile or using less of it. Unfortunately, there's no way so far to test the performance of the swapfile.

I'm not too sure about SCSI since I have never tried it but I have read Anand's article on the difference between the SCSI and EIDE versions of one hard disk. It was found that there's minimal difference in normal use. In fact, the EIDE version had a lower CPU utilization. But I think in a multi-tasking environment, SCSI is much better. However, you'll have to admit that SCSI's pricey components puts it out of mainstream use.

Actually, the head seeks from data to the swapfile isn't that much. What's more troublesome is the head seeking all over the hard disk for the scattered swapfile clusters (non-contiguous swapfile). Also, if you put the swapfile a distance away from the outer tracks, you'll lose some throughput. Check out the throughput graph of any hard disk. There's usually a curve from the highest throughput at the outermost track to the lowest throughput at the innermost track. So, moving the swapfile to the outer tracks will show an improvement in performance, especially if you use the swapfile a lot.

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


Comment #5

Adrian,

I read your swap file article with great interest. I tried to create a fixed swap file and discovered that my Defrag now runs at a snail's pace. this could be 'cause I recently downloaded Win95 Svc pack 2. Do you know anything about this? Thanks

Jon


Hello Jon,

I'm not sure if Defrag moves the swapfile to the outer tracks but if it does, then the drop in speed could be due to the rearrangement of the swapfile. Even if it doesn't, you should expect a longer time in defragmenting your swapfile than normal because the utility will need to rearrange your swapfile so that it's one contiguous block. The first time should be really long. Subsequent defragmentation sessions shouldn't take as long as the first time.

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


Comment #6

Just read your Swapfile article. I enjoyed it. I also have 192 megs on my Windows 98, PII 350. I have read to NOT tune the VCache at all in Windows 98 because it handles memory and file caching in a much more efficient way than Windows 95. Isn't it true that the file cache (vcache) holds part of the hard disk (not a copy as in Windows 95) in physical memory for faster retrieval when needed, thus effectively USING the RAM.

I have tried the min 2 and max 8 settings in VCache and the result was always having 100MB or more of free RAM while still having to access the Swapfile. Since I have read the article on not tuning VCache in Windows 98 (www.meikel.com) I have removed the VCache settings and now my RAM gets almost all used and I DO notice a performance increase in the speed. I would like to hear your comments on this.

Michael L. Ornellas


Hello Michael,

I don't think Microsoft changed the vcache algorithm. I think it just keeps a copy of whatever data that has been retrieved from the hard disk for future use. Of course, it still reads ahead (just like Win95) up to 64KB of data from the hard disk.

The question of setting the vcache size has also been bugging me. Recent tests that I have performed show that at least in some benchmarks, a very large (autoset by Win98) virtual cache can boost system performance a lot. But with a large vcache comes a higher latency while accessing the virtual cache and the need for a larger swapfile. After clearing up a few long-delayed articles, I'll embark on another quest-for-the-truth kind of article (like this one regarding the swapfile). Hopefully, that will answer all the vcache questions everyone is asking.

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


Comment #7

Hi,

Regarding your article, and user comments, the MS/Intel Defrag utility in Win98 does not move the swap file. I had been wondering too since I uninstalled most of Norton Utilities 3. So I created a new permanent swapfile on C: (normally I use it on a seperate partition so that image backups of C: can be done from Windows without having to exclude any files like Win386.swp) then ran Defrag and then installed and ran NU SpeedDisk and looked to see where the swap file was. It was at the end.

So, that answers the one question but still I would like to know if there is a simple free utility that would move the swap file to the outside (first part) of a partition or disk. This way I could once again uninstall NU.

I have found that NU is bloaty software (in fact ALL Symantec software is bloaty) that did nothing useful for my machine except for WinDoctor which I used ocassionally. I figured since Defrag and Scandisk were much improved and SpeedDisk just used Win98's speed optimization (file sorting) anyway, then why even have them taking up space?

The other thing that annoys me about NU is that it installs unneeded files. This is even worse when updating and files for components that are not installed are added to the NU directory (device drivers and dynamic link libraries, even Iomega icons, et c.). Another rant about NU concerns the install program which either through incompetent or malicious programming tries to trick you into installing components you do not want. Yes, that's right. Go down the list unselecting all the boxes except for the one required base files. The last one will not show up on the list until you scroll up and down a bit. Then one component, SpeedDisk, I think will be listed twice. If you ignore that glitch another component will also be installed. Very unprofessional.

Finally, Symantec is always woefully behind in releasing downloadable updates. They always make "Live Update" files available first. Why? Because they like to collect information about users, I guess. If one should be released later, it is the LU since it is a gimicky and uneeded "feature" compared to the NEED for fixes as soon as possible. I detest all LU type software not only for these reasons but I want to have the file for future reinstalls, and those programs do not make it easy (although sometimes you can recover them from the temp directory before closing).

Well, that's enough for now. Keep up the good work!

Ciao,

Jim @ James Talbott


Hello Jim,

Thanks for the confirmation of Defrag's inability to move the swapfile. Unfortunately, I do not know of any freeware utility that will move the swapfile to the outer tracks.

I'm no supporter of Symantec but I have found that Speed Disk defragments the hard disk much faster than Windows 98' Defrag. And Optimization Wizard is quite useful in compacting the registry. Mine gets awful bloated after a while and compacting it speeds up start-up time.

I noticed the same thing about the installation of Norton Utilities. I think that was a bug in the installer that fails to refresh the screen or something like that. But clicking on the component will reveal what it really is.

And I agree with you regarding LiveUpdate as well. I would prefer to download the updates manually myself. Besides protecting my privacy from prying eyes, I can also save the updates for future use. Otherwise, I would have to redownload all the updates all over again, if I reinstall Norton Utilities. But luckily, Symantec has the foresight to at least post the updates for manual downloading. Microsoft doesn't even bother.

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


Comment #8

Your site is excellent and the article on Optimising the Swap File is likewise superb, as are the other pages I downloaded.

Thank you and keep up the good work,

Alan R Parsons


Thanks, Alan! :)

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


Comment #9

Hello,

Thanks for the information on the swapfile, very informative! If one has 128MB, is it still recommended in Win98, to change from "Desktop PC" to "Network Server"? And how does this relate to the "fixing" of the swapfile?

Thanks,

Ed Hayes


Hello Ed,

The swapfile size has nothing to do with the File System setting of "Desktop PC" or "Network Server". Changing from "Desktop PC" to "Network Server" will increase the number of directory paths cached to 64 and the number of filenames cached to 2729. This results in faster searches and disk access. But it has virtually nothing to do with the swapfile.

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


Comment #10

Dear Adrian,

I have a question on hard disk life:

Is it true that often used sections wear faster? After all, magnetizing and demagnetizing may affect the magnetic materials. (I assume that there is no physical contact between heads and platter surface?). If there is a relationship between use and wear, a permanent swapfile could reduce the life of a hard disk, because that (especially the first part) is probably the part that is used most often in reading/writing cycles. Is this a consideration that will affect the MTBF?

Yours,

Peter van Tienderen


Hello Peter,

No, there's no physical contact between the heads and the platter. The writing and rewriting of the same area won't cause any problems. I'll let Bob of Seagate explain :-

This should not hurt the drive at all. As you are aware, the heads are actually suspended above the platters on an air bearing, so there is no direct contact with the media. As far as the recording and re-recording of the same tracks, also no problems. What we are dealing with here in order to write the data is simply moving the magnetic domain one way or the other, no wear involved.

Regards, Bob

Well, I hope that answers your question! :)

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/ !