Link to home
Start Free TrialLog in
Avatar of loopguru
loopguru

asked on

Optimal Placement of the Swap File on a system with one fast HD and one slower HD (Windows XP)

An age old question:

I have a system with two hard drives. The first is a 10000-rpm 70GB drive. The second is a 7200-rpm 120GB drive. There is 1GB of RAM.
Given this scenario, which of the following locations of the swap-file (SF) would be optimal, in terms of performance (i.e., which would most likely yield the least access time)?

(1) Place the SF in a first 2GB partition on the Fast drive. The OS would be loaded into an imediately subsequent partition.
(2) Place the OS in a first partition on the Fast drive. Place the SF on a 2GB partition immediately following the first partition.
(3) Place the OS on the Fast Drive. Place the SF in the first partition of the Slow drive.
(4) Place the SF on the Fast Drive. Place the OS on the Slow drive.
(5) Other Suggestions??

Keep in mind, that I would like to XP to maintain the ability to create a memory dump, if necessary. Therefore, per Microsoft's suggestion, some of the swap-file should be resident on the boot partition (cf. http://support.microsoft.com/?kbid=314482).

If the drives were the same speed, I would likely opt for the third configuration. However, since the drives are not the same speed, the rotational latency of the Slow drive must be taken into account, as such latencies are often not trivial relative to the seek time. Advice I've read generally suggests placing the swap-file on the fastest drive. Others insist the swap-file should be on the first partition of a secondary drive (if possible). This begs the question then: where should the OS go? The guidance on the web is somewhat inconsistent and, at times, contradictory.

Please assume that the virtual memory system will be sufficiently taxed so that the placement of the swap-file would actually make a difference.  

Another question: Some have suggested that the partition containing the swap-file should be FAT, as opposed to NTFS, essentially because FAT is simpler (e.g., no evaluation of access rightsand generally uses larger clusters, etc.). I think this view is somewhat simplistic and does not take into account the overhead in using a cluster size different from XP's default. There may be some merit, though, to using this scheme for a relatively small partition containing one file (namely the swap-file). The advantages of FAT's simplicity and usage of a larger cluster may supercede the superior efficiency of NTFS, for small volumes (cf.  http://www.microsoft.com/resources/documentation/Windows/2000/server/reskit/en-us/Default.asp?url=/resources/documentation/Windows/2000/server/reskit/en-us/core/fncc_fil_yula.asp). I don't know if 2GB (see above; clearly this discussion does not apply to FAT16) would qualify as "small volume". Is this nonsense (as I suspect), or is using a FAT partition a good idea in this case?

Thanks.
ks


Avatar of joedoe58
joedoe58

I would go with option 4 since the difference in speed is not so big and the swap file will be used more during program use than compared to the performance hit on starting a program from a slower disk. You can also circumvent that by installin your programs to the seccond disk.
Actually, iw ould place them BOTH on the fast disk. Since it would both speed up loading and caching, its probally the best idea. Personally i would prefer daving theprogras i run a lot (like windows and other load on boot programs) on the fastest drive. The other drive would be for less used programs, and will such be more a data storage. Windows and the swap file can reside on the same disk, so thats not a problem.

Now im wondering, WHY didnt you say the option "put em both on the fast"? any specific reason for this? or do you just want to know what is faster from those 4 options?

A second thing, keep in mind that the speed increases wont be blowing of the roof.
Avatar of loopguru

ASKER

I probably wasn't clear. In the first two options above (i.e., (1) and (2)), both the OS and swap-file are on the same disk - in adjacent partitions of the Fast drive.
ks
The recomendation from MS is always to separate the swap file from the OS if possible even it it is only on two partitions on the same drive. This has also been the practice I have followed with success for years.
ASKER CERTIFIED SOLUTION
Avatar of rajeev_nice
rajeev_nice

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I've just finished some work on this, with analysis. My opinion:

1) Put Win2k on first partition of Fast. It *will* be used a lot, and is most easily booted/etc from here
2) Put swap in a partition of its own *near the middle* (physical) of the fast drive

And yes, absolutely put a small swap partition on boot. You can't even get minidumps without that.

The above maximises speed (minimal seek etc) under almost all conditions.

It is most like your #2 i believe.
[Sorry about my mention of "Win2K"; I meant "Windows" :-D]

KS, I just realized I never answered your second question. So, let's be complete here:

Given that your swap partition will be dedicated to just swap, it makes no practical difference *at all* whether it is NTFS or FAT.

1) File/directory overhead is meaningless, because there will be one (swap) file open at all times as soon as the OS boots, and the file is of constant size.
2) Cluster size is also not really an issue. The partition will be small so clusters will be small. XP "default" doesn't matter -- it's quite capable of handling anything. And, AFAIK, a swap file is quite special in how it is handled in any case.

Going back to your first question, about where to place the swap and the OS:

FalconHawk gave a pretty good answer, except that the swap ideally wants to be in the physical center of your fast drive, because it will be by far the most-used disk area, and putting it in the center minimizes seek time for swap in/out.

Further notes on my recommendations in the previous message:
a) Why put Windows on the fast partition? Because it is used a lot! At any given time, quite a lot of Windows is mapped into memory, the temp files, registry and much more are open, etc etc etc (yes, much of this could be moved but why bother!)
b) Speed difference: yes, the 10k rpm vs 7.2k rpm is one factor. Other important factors: seek time, on-drive cache size, and platter density (more data per platter == more data transferred per revolution.) A small factor usually: interface speed (i.e. 66/100/133 etc)

Usually, a 10k drive is tuned for performance. However, if the 7200 rpm drive is significantly newer, it might equal or even beat the 10k drive in a fair fight!

Have fun putting this together...
So loopguru, have you had a chance to implement anything?
Sorry Pete, I have been extremely busy. I will hopefully complete everything by the end of the weekend and post responses to each of your comments as well as to the comments of the other contributors.
ks
no prob. Busy here too!
Now that an answer has been accepted, I'll add a comment here for future browsers.

IMO, the accepted answer is misleading/wrong.

> With 1 GB or more RAM, u can also consider against using virtual memory unless u use the things listed in #3. invest in  another GB of RAM and u can be better off without the SF.

A) If you eliminate the swap file, then any Blue Screen crash can no longer be diagnosed. Swap file, on C:, is required for memory dump.

>1. The least used Hard Disk which means the one having least I/Os.
>2. The Hard DIsk other than the one with OS.
>3. if u use anything heavy like Video Editing, Exhange server/DB server or Web Server or High End Games...  Never place SF on the disk having these things on them.

B) Swap File placement typically has more impact on system performance than (almost?) any application-file placement. The swap file is basically third-level RAM cache.
C) When multiple "heavy" processes are running, you've just got to pick. With sufficient RAM and on-disk cache, having them all on the faster drive may be better than relegating one to a slower drive. A tradeoff of more seeks vs slower seeks and data transfer.

Bottom line: Instead of prioritizing based on which disk is *already* most/least used... it is better to prioritize based on which *files* require most/least *performance*. Place the high-impact files on the high-performance drive. Place low-impact files on the slower media.